简体   繁体   中英

svn senior Developer confirmation before commit codes

I want to check Junior developer's codes via senior Developer before they commit their codes to SVN. How can I manage it with SVN? My point is senior Developer notifies Junior developer want to commit their codes (for example with email) and after they confirmed, codes commit. our SVN is on windows server

thank you.

Subversion does not directly support a "code review" model like you may be used to with a GitHub Pull Request. There are some add-on tools that may help here, but I can't recommend any as I've never used them.

What you may want to try is to have developers working in their own branches and committing to that, then ask the senior developer to review and then merge to a central trunk or other branch.

There are two possibilities:

  1. You can use branches and the --reintegrate option in SVN to merge them automatically back into the trunk. This works fairly well as long as you follow some rules(you can bend them, you can break them, but you will encounter difficulties):

    • never do any subtree merges (merge subdirectories; merge only on trunk or branch level)
    • never merge between different branches except the path you are branching from (normally this would be trunk). So no crossbranching from colleagues.
    • always merge all commits from branch into trunk and always sync completely your branch from trunk. So no cherry picking
    • by following these rules you can easily merge and keep your trunk clean without using any revision number. See svnbook/merging for more details.
    • also this means the integration merge(from developerbranch into trunk) is always conflict free as all changes (in trunk) are usually merged by the developer beforehand. If trunk maintainer encounters a conflict during merge he rejects the branch and tells developer to sync merge from trunk to resolve this conflict on his branch
    • you should protect trunk from commits of the junior developers but it is neither necessary nor important for the overall process
    • See also https://stackoverflow.com/a/7387277/23264 for further information (with some fancy ascii art)
  2. you can accept patches for people to send around. This is a quite manual process but it depends on how many Junior Developer you have. Note that while it sounds impossible the whole svn development process works by sending patches to the mailing list until you sent enough to get committer-privilege.

You can make your junior devs work on branches only, and stop them committing to trunk. You can do that by either setting permissions to specific repo paths on the SVN server, or by writing a pre-commit hook.

If you're using VisualSVN Server, you can configure it on this dialog:

VisualSVN服务器路径属性

I've kind-of cheated here in this example, by setting an overriding permission. For larger teams, you'd want something more scalable where you set read-only permissions on the repo and then explicitly grant access to /branches/ for the developers, and /trunk/ for senior devs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM