# HG changeset patch # User Laurent Charignon # Date 1436387416 25200 # Node ID db9d85618d3d6c59b3fb2e31cee441ba96040095 # Parent 356460fb01fa01b06a5e971977177f5406ae9ac6 wrapper: delay marker creation in push Before this patch we were creating obsolescence markers when pulling the changesets from subversion. The counterpart stripping logic (when obsolescence is not available) was done after pushing everything. This patch moves the marker creation to the end of the push, to: 1) Make the code more readable (the marker creation and the stripping should be in the same place) 2) Fix a behavior issue with inhibit(evolve) (see below) With inhibit + hgsubversion enabled. When pushing to subversion we were creating markers as expected but inhibiting the marker on the commit that was the parent of the working copy making it therefore visible. By delaying the marker creation to after the update we avoid this issue. diff --git a/hgsubversion/wrappers.py b/hgsubversion/wrappers.py --- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -204,6 +204,7 @@ def push(repo, dest, force, revs): hasobsolete = False temporary_commits = [] + obsmarkers = [] try: # TODO: implement --rev/#rev support # TODO: do credentials specified in the URL still work? @@ -300,9 +301,7 @@ def push(repo, dest, force, revs): if meta.get_source_rev(ctx=c)[0] == pushedrev.revnum: # This is corresponds to the changeset we just pushed if hasobsolete: - ui.note('marking %s as obsoleted by %s\n' % - (original_ctx.hex(), c.hex())) - obsolete.createmarkers(repo, [(original_ctx, [c])]) + obsmarkers.append([(original_ctx, [c])]) tip_ctx = c @@ -343,7 +342,14 @@ def push(repo, dest, force, revs): finally: util.swap_out_encoding() - if not hasobsolete: + if hasobsolete: + for marker in obsmarkers: + obsolete.createmarkers(repo, marker) + beforepush = marker[0][0] + afterpush = marker[0][1][0] + ui.note('marking %s as obsoleted by %s\n' % + (beforepush.hex(), afterpush.hex())) + else: # strip the original changesets since the push was # successful and changeset obsolescence is unavailable util.strip(ui, repo, outgoing, "all")