Mercurial > evolve
changeset 729:2e46caeb2890
push obsolescence marker before anything else
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 03 Jun 2013 15:03:55 +0200 |
parents | 5d368ae3d5a0 |
children | ea629193a25e |
files | hgext/pushexperiment.py |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/pushexperiment.py Mon Jun 03 14:57:39 2013 +0200 +++ b/hgext/pushexperiment.py Mon Jun 03 15:03:55 2013 +0200 @@ -3,6 +3,7 @@ - Add a new wire protocol command to exchange obsolescence marker. Sending the raw file as a binary instead of using pushkey hack. - Add a "push done" notification +- Push obsolescence marker before anything else (This work arround the lack global transaction) """ @@ -51,12 +52,7 @@ if not (obsolete._enabled and repo.obsstore): return if remote.capable('_push_experiment_pushobsmarkers_0'): - try: - obsfp = repo.sopener('obsstore') - except IOError as e: - if e.errno != errno.ENOENT: - raise - return + return # already pushed before changeset remote.push_experiment_pushobsmarkers_0(obsfp) return return orig(repo, remote) @@ -75,8 +71,18 @@ return wireproto.pushres(0) -def notifiedpush(orig, repo, remote, *args, **kwargs): +def augmented_push(orig, repo, remote, *args, **kwargs): """push wrapped that call the wire protocol command""" + if (obsolete._enabled and repo.obsstore + and remote.capable('_push_experiment_pushobsmarkers_0')): + # push marker early to limit damage of pushing too early. + try: + obsfp = repo.sopener('obsstore') + except IOError as e: + if e.errno != errno.ENOENT: + raise + else: + remote.push_experiment_pushobsmarkers_0(obsfp) ret = orig(repo, remote, *args, **kwargs) if remote.capable('_push_experiment_notifypushend_0'): remote.push_experiment_notifypushend_0() @@ -99,6 +105,6 @@ wireproto.commands['push_experiment_notifypushend_0'] = (srv_notifypushend, '') extensions.wrapfunction(wireproto, 'capabilities', capabilities) extensions.wrapfunction(obsolete, 'syncpush', syncpush) - extensions.wrapfunction(localrepo.localrepository, 'push', notifiedpush) + extensions.wrapfunction(localrepo.localrepository, 'push', augmented_push)