changeset 1340:db9d85618d3d

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.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 08 Jul 2015 13:30:16 -0700
parents 356460fb01fa
children 7e10891666fe
files hgsubversion/wrappers.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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")