##// END OF EJS Templates
convert: fix authormap handling of lines without '='...
Marti Raudsepp -
r7962:62154415 default
parent child Browse files
Show More
@@ -197,24 +197,28 b' class converter(object):'
197 def readauthormap(self, authorfile):
197 def readauthormap(self, authorfile):
198 afile = open(authorfile, 'r')
198 afile = open(authorfile, 'r')
199 for line in afile:
199 for line in afile:
200
200 if line.strip() == '':
201 if line.strip() == '':
201 continue
202 continue
203
202 try:
204 try:
203 srcauthor, dstauthor = line.split('=', 1)
205 srcauthor, dstauthor = line.split('=', 1)
206 except ValueError:
207 msg = _('Ignoring bad line in author map file %s: %s\n')
208 self.ui.warn(msg % (authorfile, line.rstrip()))
209 continue
210
204 srcauthor = srcauthor.strip()
211 srcauthor = srcauthor.strip()
205 dstauthor = dstauthor.strip()
212 dstauthor = dstauthor.strip()
206 if srcauthor in self.authors and dstauthor != self.authors[srcauthor]:
213 if self.authors.get(srcauthor) in (None, dstauthor):
207 self.ui.status(
214 msg = _('mapping author %s to %s\n')
208 _('Overriding mapping for author %s, was %s, will be %s\n')
215 self.ui.debug(msg % (srcauthor, dstauthor))
209 % (srcauthor, self.authors[srcauthor], dstauthor))
210 else:
211 self.ui.debug(_('mapping author %s to %s\n')
212 % (srcauthor, dstauthor))
213 self.authors[srcauthor] = dstauthor
216 self.authors[srcauthor] = dstauthor
214 except IndexError:
217 continue
215 self.ui.warn(
218
216 _('Ignoring bad line in author map file %s: %s\n')
219 m = _('overriding mapping for author %s, was %s, will be %s\n')
217 % (authorfile, line.rstrip()))
220 self.ui.status(m % (srcauthor, self.authors[srcauthor], dstauthor))
221
218 afile.close()
222 afile.close()
219
223
220 def cachecommit(self, rev):
224 def cachecommit(self, rev):
@@ -15,6 +15,8 b' cd ..'
15 # Explicit --authors
15 # Explicit --authors
16 cat > authormap.txt <<EOF
16 cat > authormap.txt <<EOF
17 user name = Long User Name
17 user name = Long User Name
18
19 this line is ignored
18 EOF
20 EOF
19
21
20 hg convert --authors authormap.txt orig new
22 hg convert --authors authormap.txt orig new
@@ -1,4 +1,5 b''
1 initializing destination new repository
1 initializing destination new repository
2 Ignoring bad line in author map file authormap.txt: this line is ignored
2 scanning source...
3 scanning source...
3 sorting...
4 sorting...
4 converting...
5 converting...
@@ -12,6 +13,7 b' user: Long User Name'
12 date: Thu Jan 01 00:00:00 1970 +0000
13 date: Thu Jan 01 00:00:00 1970 +0000
13 summary: foo
14 summary: foo
14
15
16 Ignoring bad line in author map file new/.hg/authormap: this line is ignored
15 scanning source...
17 scanning source...
16 sorting...
18 sorting...
17 converting...
19 converting...
General Comments 0
You need to be logged in to leave comments. Login now