##// END OF EJS Templates
convert: support multiple specifed revs in git source...
Durham Goode -
r25749:f2748cc4 default
parent child Browse files
Show More
@@ -89,10 +89,6 b' class convert_git(converter_source):'
89 def __init__(self, ui, path, revs=None):
89 def __init__(self, ui, path, revs=None):
90 super(convert_git, self).__init__(ui, path, revs=revs)
90 super(convert_git, self).__init__(ui, path, revs=revs)
91
91
92 if revs and len(revs) > 1:
93 raise util.Abort(_("git source does not support specifying "
94 "multiple revs"))
95
96 if os.path.isdir(path + "/.git"):
92 if os.path.isdir(path + "/.git"):
97 path += "/.git"
93 path += "/.git"
98 if not os.path.exists(path + "/objects"):
94 if not os.path.exists(path + "/objects"):
@@ -126,12 +122,15 b' class convert_git(converter_source):'
126 if not self.revs:
122 if not self.revs:
127 heads, ret = self.gitread('git rev-parse --branches --remotes')
123 heads, ret = self.gitread('git rev-parse --branches --remotes')
128 heads = heads.splitlines()
124 heads = heads.splitlines()
125 if ret:
126 raise util.Abort(_('cannot retrieve git heads'))
129 else:
127 else:
130 heads, ret = self.gitread("git rev-parse --verify %s" %
128 heads = []
131 self.revs[0])
129 for rev in self.revs:
132 heads = [heads[:-1]]
130 rawhead, ret = self.gitread("git rev-parse --verify %s" % rev)
133 if ret:
131 heads.append(rawhead[:-1])
134 raise util.Abort(_('cannot retrieve git heads'))
132 if ret:
133 raise util.Abort(_('cannot retrieve git head "%s"') % rev)
135 return heads
134 return heads
136
135
137 def catfile(self, rev, type):
136 def catfile(self, rev, type):
@@ -442,6 +442,40 b' convert author committer'
442 abort: --sourcesort is not supported by this data source
442 abort: --sourcesort is not supported by this data source
443 [255]
443 [255]
444
444
445 test converting certain branches
446
447 $ mkdir git-testrevs
448 $ cd git-testrevs
449 $ git init
450 Initialized empty Git repository in $TESTTMP/git-testrevs/.git/
451 $ echo a >> a ; git add a > /dev/null; git commit -m 'first' > /dev/null
452 $ echo a >> a ; git add a > /dev/null; git commit -m 'master commit' > /dev/null
453 $ git checkout -b goodbranch 'HEAD^'
454 Switched to a new branch 'goodbranch'
455 $ echo a >> b ; git add b > /dev/null; git commit -m 'good branch commit' > /dev/null
456 $ git checkout -b badbranch 'HEAD^'
457 Switched to a new branch 'badbranch'
458 $ echo a >> c ; git add c > /dev/null; git commit -m 'bad branch commit' > /dev/null
459 $ cd ..
460 $ hg convert git-testrevs hg-testrevs --rev master --rev goodbranch
461 initializing destination hg-testrevs repository
462 scanning source...
463 sorting...
464 converting...
465 2 first
466 1 good branch commit
467 0 master commit
468 updating bookmarks
469 $ cd hg-testrevs
470 $ hg log -G -T '{rev} {bookmarks}'
471 o 2 master
472 |
473 | o 1 goodbranch
474 |/
475 o 0
476
477 $ cd ..
478
445 test sub modules
479 test sub modules
446
480
447 $ mkdir git-repo5
481 $ mkdir git-repo5
General Comments 0
You need to be logged in to leave comments. Login now