|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
[PATCH] exit codes for the action_* methodsThis patch adds exit codes to the action_* methods.
All the methods will return 0, except the svnmerge avail action when no candidates are found. It will then return 2 This can be used when creating an automated merge (svn-automerge) We use this to allow developers to set a property on their developerbranch and a cronjob on the server will run svnmerge every hour on all the branches that have this property set. That way we keep the branches in sync with their source. To speed up the whole cronjob we needed a way to detect wether a branch needs an svnmerge. So we added exit codes and return 2 if the action_avail finds no revs to merge. Code based on a patch from Digium http://svnview.digium.com/svn/repotools/svnmerge?r1=5&r2=6 -- Michiel van Baak michiel@... http://michiel.vanbaak.eu GnuPG key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x71C946BD "Why is it drug addicts and computer aficionados are both called users?" --- svnmerge.py Thu Aug 13 17:12:55 2009 +++ svnmerge Sat Oct 31 22:49:57 2009 @@ -1415,6 +1415,8 @@ f.close() report('wrote commit message to "%s"' % opts["commit-file"]) + return 0 + def action_avail(branch_dir, branch_props): """Show commits available for merges.""" source_revs, phantom_revs, reflected_revs, initialized_revs = \ @@ -1443,10 +1445,15 @@ if opts["revision"]: revs = revs & RevisionSet(opts["revision"]) + if not revs: + return 2 + display_revisions(revs, opts["avail-display"], report_msg, opts["source-url"]) + return 0 + def action_integrated(branch_dir, branch_props): """Show change sets already merged. This set of revisions is calculated from taking svnmerge-integrated property from the @@ -1471,6 +1478,8 @@ display_revisions(revs, opts["integrated-display"], "revisions already integrated are:", opts["source-url"]) + return 0 + def action_merge(branch_dir, branch_props): """Record merge meta data, and do the actual merge (if not requested otherwise via --record-only).""" @@ -1565,6 +1574,8 @@ f.close() report('wrote commit message to "%s"' % opts["commit-file"]) + return 0 + def action_block(branch_dir, branch_props): """Block revisions.""" # Check branch directory is ready for being modified @@ -1598,6 +1609,8 @@ f.close() report('wrote commit message to "%s"' % opts["commit-file"]) + return 0 + def action_unblock(branch_dir, branch_props): """Unblock revisions.""" # Check branch directory is ready for being modified @@ -1628,6 +1641,8 @@ f.close() report('wrote commit message to "%s"' % opts["commit-file"]) + return 0 + def action_rollback(branch_dir, branch_props): """Rollback previously integrated revisions.""" @@ -1706,6 +1721,8 @@ branch_props[opts["source-pathid"]] = str(merged_revs) set_merge_props(branch_dir, branch_props) + return 0 + def action_uninit(branch_dir, branch_props): """Uninit SOURCE URL.""" # Check branch directory is ready for being modified @@ -1734,6 +1751,8 @@ f.close() report('wrote commit message to "%s"' % opts["commit-file"]) + return 0 + ############################################################################### # Command line parsing -- options and commands management ############################################################################### @@ -2358,12 +2377,14 @@ opts["source-pathid"]) # Perform the action - cmd(branch_dir, branch_props) + return cmd(branch_dir, branch_props) if __name__ == "__main__": + result = 1 try: - main(sys.argv[1:]) + result = main(sys.argv[1:]) + sys.exit(result) except LaunchError, (ret, cmd, out): err_msg = "command execution failed (exit code: %d)\n" % ret err_msg += cmd + "\n" |
|
|
Re: [PATCH] exit codes for the action_* methodsI redirected Michiel on IRC to the svnmerge mailing list.
Michiel van Baak wrote on Sat, 31 Oct 2009 at 23:26 +0100: > This patch adds exit codes to the action_* methods. > All the methods will return 0, except the svnmerge avail action when no > candidates are found. It will then return 2 > > This can be used when creating an automated merge (svn-automerge) > > We use this to allow developers to set a property on their > developerbranch and a cronjob on the server will run svnmerge every hour > on all the branches that have this property set. > That way we keep the branches in sync with their source. > > To speed up the whole cronjob we needed a way to detect wether a branch > needs an svnmerge. So we added exit codes and return 2 if the > action_avail finds no revs to merge. > > Code based on a patch from Digium > http://svnview.digium.com/svn/repotools/svnmerge?r1=5&r2=6 > > ------------------------------------------------------ http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414626 |
| Free embeddable forum powered by Nabble | Forum Help |