Show More
@@ -56,6 +56,36 b' svn_source = subversion.svn_source' | |||
|
56 | 56 | orig_encoding = b'ascii' |
|
57 | 57 | |
|
58 | 58 | |
|
59 | def readauthormap(ui, authorfile, authors=None): | |
|
60 | if authors is None: | |
|
61 | authors = {} | |
|
62 | with open(authorfile, b'rb') as afile: | |
|
63 | for line in afile: | |
|
64 | ||
|
65 | line = line.strip() | |
|
66 | if not line or line.startswith(b'#'): | |
|
67 | continue | |
|
68 | ||
|
69 | try: | |
|
70 | srcauthor, dstauthor = line.split(b'=', 1) | |
|
71 | except ValueError: | |
|
72 | msg = _(b'ignoring bad line in author map file %s: %s\n') | |
|
73 | ui.warn(msg % (authorfile, line.rstrip())) | |
|
74 | continue | |
|
75 | ||
|
76 | srcauthor = srcauthor.strip() | |
|
77 | dstauthor = dstauthor.strip() | |
|
78 | if authors.get(srcauthor) in (None, dstauthor): | |
|
79 | msg = _(b'mapping author %s to %s\n') | |
|
80 | ui.debug(msg % (srcauthor, dstauthor)) | |
|
81 | authors[srcauthor] = dstauthor | |
|
82 | continue | |
|
83 | ||
|
84 | m = _(b'overriding mapping for author %s, was %s, will be %s\n') | |
|
85 | ui.status(m % (srcauthor, authors[srcauthor], dstauthor)) | |
|
86 | return authors | |
|
87 | ||
|
88 | ||
|
59 | 89 | def recode(s): |
|
60 | 90 | if isinstance(s, pycompat.unicode): |
|
61 | 91 | return s.encode(pycompat.sysstr(orig_encoding), 'replace') |
@@ -448,32 +478,7 b' class converter(object):' | |||
|
448 | 478 | ofile.close() |
|
449 | 479 | |
|
450 | 480 | def readauthormap(self, authorfile): |
|
451 | afile = open(authorfile, b'rb') | |
|
452 | for line in afile: | |
|
453 | ||
|
454 | line = line.strip() | |
|
455 | if not line or line.startswith(b'#'): | |
|
456 | continue | |
|
457 | ||
|
458 | try: | |
|
459 | srcauthor, dstauthor = line.split(b'=', 1) | |
|
460 | except ValueError: | |
|
461 | msg = _(b'ignoring bad line in author map file %s: %s\n') | |
|
462 | self.ui.warn(msg % (authorfile, line.rstrip())) | |
|
463 | continue | |
|
464 | ||
|
465 | srcauthor = srcauthor.strip() | |
|
466 | dstauthor = dstauthor.strip() | |
|
467 | if self.authors.get(srcauthor) in (None, dstauthor): | |
|
468 | msg = _(b'mapping author %s to %s\n') | |
|
469 | self.ui.debug(msg % (srcauthor, dstauthor)) | |
|
470 | self.authors[srcauthor] = dstauthor | |
|
471 | continue | |
|
472 | ||
|
473 | m = _(b'overriding mapping for author %s, was %s, will be %s\n') | |
|
474 | self.ui.status(m % (srcauthor, self.authors[srcauthor], dstauthor)) | |
|
475 | ||
|
476 | afile.close() | |
|
481 | self.authors = readauthormap(self.ui, authorfile, self.authors) | |
|
477 | 482 | |
|
478 | 483 | def cachecommit(self, rev): |
|
479 | 484 | commit = self.source.getcommit(rev) |
General Comments 0
You need to be logged in to leave comments.
Login now