##// END OF EJS Templates
convert: use branchmap to change default branch in destination (issue3469)...
lstewart -
r20331:1d155582 stable
parent child Browse files
Show More
@@ -371,7 +371,12 b' class converter(object):'
371 def cachecommit(self, rev):
371 def cachecommit(self, rev):
372 commit = self.source.getcommit(rev)
372 commit = self.source.getcommit(rev)
373 commit.author = self.authors.get(commit.author, commit.author)
373 commit.author = self.authors.get(commit.author, commit.author)
374 commit.branch = self.branchmap.get(commit.branch, commit.branch)
374 # If commit.branch is None, this commit is coming from the source
375 # repository's default branch and destined for the default branch in the
376 # destination repository. For such commits, passing a literal "None"
377 # string to branchmap.get() below allows the user to map "None" to an
378 # alternate default branch in the destination repository.
379 commit.branch = self.branchmap.get(str(commit.branch), commit.branch)
375 self.commitcache[rev] = commit
380 self.commitcache[rev] = commit
376 return commit
381 return commit
377
382
@@ -96,3 +96,35 b' Test hg failing to call itself'
96
96
97 $ HG=foobar hg convert svn-repo B-hg 2>&1 | grep abort
97 $ HG=foobar hg convert svn-repo B-hg 2>&1 | grep abort
98 abort: Mercurial failed to run itself, check hg executable is in PATH
98 abort: Mercurial failed to run itself, check hg executable is in PATH
99
100 Convert 'trunk' to branch other than 'default'
101
102 $ cat > branchmap <<EOF
103 > None hgtrunk
104 >
105 >
106 > EOF
107 $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo C-hg
108 initializing destination C-hg repository
109 scanning source...
110 sorting...
111 converting...
112 10 init projA
113 9 hello
114 8 branch trunk, remove c and dir
115 7 change a
116 6 change b
117 5 move and update c
118 4 move and update c
119 3 change b again
120 2 move to old2
121 1 move back to old
122 0 last change to a
123
124 $ cd C-hg
125 $ hg branches
126 hgtrunk 10:745f063703b4
127 old 9:aa50d7b8d922
128 old2 8:c85a22267b6e (inactive)
129 $ cd ..
130
General Comments 0
You need to be logged in to leave comments. Login now