[PATCH 2 of 3] convert: allow the converter_source to say "skip this revision"

Alexis S. L. Carvalho alexis at cecm.usp.br
Sat Sep 1 01:56:37 CDT 2007


# HG changeset patch
# User Alexis S. L. Carvalho <alexis at cecm.usp.br>
# Date 1188629314 10800
# Node ID 14b43c5dfd0035b7d8e6e35dfe72cb5157a3482b
# Parent  7a0981570761487210b271a5e48305e95317070d
convert: allow the converter_source to say "skip this revision"

The converter_source is responsible for rewriting the parents of
the commit objects to make sure the revision graph makes sense.

diff -r 7a0981570761 -r 14b43c5dfd00 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py	Sat Sep 01 03:48:34 2007 -0300
+++ b/hgext/convert/__init__.py	Sat Sep 01 03:48:34 2007 -0300
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms
 # of the GNU General Public License, incorporated herein by reference.
 
-from common import NoRepo, converter_source, converter_sink
+from common import SKIPREV, NoRepo, converter_source, converter_sink
 from cvs import convert_cvs
 from git import convert_git
 from hg import mercurial_source, mercurial_sink
@@ -198,7 +198,11 @@ class converter(object):
         do_copies = hasattr(self.dest, 'copyfile')
         filenames = []
 
-        files, copies = self.source.getchanges(rev)
+        changes = self.source.getchanges(rev)
+        if changes == SKIPREV:
+            self.mapentry(rev, SKIPREV)
+            return
+        files, copies = changes
         parents = [self.map[r] for r in commit.parents]
         if commit.parents:
             prev = commit.parents[0]
@@ -258,7 +262,7 @@ class converter(object):
             ctags = {}
             for k in tags:
                 v = tags[k]
-                if v in self.map:
+                if self.map.get(v, SKIPREV) != SKIPREV:
                     ctags[k] = self.map[v]
 
             if c and ctags:
diff -r 7a0981570761 -r 14b43c5dfd00 hgext/convert/common.py
--- a/hgext/convert/common.py	Sat Sep 01 03:48:34 2007 -0300
+++ b/hgext/convert/common.py	Sat Sep 01 03:48:34 2007 -0300
@@ -16,6 +16,8 @@ def decodeargs(s):
     return pickle.loads(s)
 
 class NoRepo(Exception): pass
+
+SKIPREV = 'hg-convert-skipped-revision'
 
 class commit(object):
     def __init__(self, author, date, desc, parents, branch=None, rev=None):


More information about the Mercurial-devel mailing list