Patchwork [4,of,5] convert: only consider shamap revisions converted if they still exists

login
register
mail settings
Submitter Mads Kiilerich
Date May 19, 2014, 8:33 p.m.
Message ID <c28cc8a6bd6226f05883.1400531612@mk-desktop>
Download mbox | patch
Permalink /patch/4818/
State Accepted
Commit 3de9f2c4900c58d196b74026f84e75cb619699be
Headers show

Comments

Mads Kiilerich - May 19, 2014, 8:33 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1400530351 -7200
#      Mon May 19 22:12:31 2014 +0200
# Node ID c28cc8a6bd6226f0588365d5ae8e3d8a42cfa063
# Parent  8b9f31e85407fef886a08b55be31665f02319fde
convert: only consider shamap revisions converted if they still exists

Rollback or strip could leave a Mercurial repo with a shamap with revisions no
longer in the repository.

To ensure reliable conversions we now check that the commit actually exists and
consider it non-existing if it doesn't exist.
Matt Mackall - May 29, 2014, 10:54 p.m.
On Mon, 2014-05-19 at 22:33 +0200, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1400530351 -7200
> #      Mon May 19 22:12:31 2014 +0200
> # Node ID c28cc8a6bd6226f0588365d5ae8e3d8a42cfa063
> # Parent  8b9f31e85407fef886a08b55be31665f02319fde
> convert: only consider shamap revisions converted if they still exists

Queued these four for default, thanks.

Patch

diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -173,8 +173,12 @@  class converter(object):
         parents = {}
         while visit:
             n = visit.pop(0)
-            if n in known or n in self.map:
+            if n in known:
                 continue
+            if n in self.map:
+                m = self.map[n]
+                if m == SKIPREV or self.dest.hascommitfrommap(m):
+                    continue
             known.add(n)
             self.ui.progress(_('scanning'), len(known), unit=_('revisions'))
             commit = self.cachecommit(n)
diff --git a/tests/test-convert-hg-sink.t b/tests/test-convert-hg-sink.t
--- a/tests/test-convert-hg-sink.t
+++ b/tests/test-convert-hg-sink.t
@@ -524,8 +524,11 @@  Conversion after rollback
   scanning source...
   sorting...
   converting...
+  0 extra f+a-only change
 
   $ hg -R a log -G -T '{rev} {desc|firstline} ({files})\n'
+  o  3 extra f+a-only change (f)
+  |
   o  2 x (f)
   |
   @  1 a (f)