Show More
@@ -38,7 +38,7 b' class convert(object):' | |||||
38 | self.mapfile = mapfile |
|
38 | self.mapfile = mapfile | |
39 | self.mapfilefd = None |
|
39 | self.mapfilefd = None | |
40 | self.authors = {} |
|
40 | self.authors = {} | |
41 |
self. |
|
41 | self.authorfile = None | |
42 |
|
42 | |||
43 | self.map = {} |
|
43 | self.map = {} | |
44 | try: |
|
44 | try: | |
@@ -51,12 +51,15 b' class convert(object):' | |||||
51 | pass |
|
51 | pass | |
52 |
|
52 | |||
53 | # Read first the dst author map if any |
|
53 | # Read first the dst author map if any | |
54 | if hasattr(self.dest, 'authorfile'): |
|
54 | authorfile = self.dest.authorfile() | |
55 | self.readauthormap(self.dest.authorfile()) |
|
55 | if authorfile and os.path.exists(authorfile): | |
|
56 | self.readauthormap(authorfile) | |||
56 | # Extend/Override with new author map if necessary |
|
57 | # Extend/Override with new author map if necessary | |
57 |
if 'authors' |
|
58 | if opts.get('authors'): | |
|
59 | import pdb | |||
|
60 | pdb.set_trace() | |||
58 | self.readauthormap(opts.get('authors')) |
|
61 | self.readauthormap(opts.get('authors')) | |
59 |
self. |
|
62 | self.authorfile = self.dest.authorfile() | |
60 |
|
63 | |||
61 | def walktree(self, heads): |
|
64 | def walktree(self, heads): | |
62 | visit = heads |
|
65 | visit = heads | |
@@ -142,8 +145,8 b' class convert(object):' | |||||
142 | self.mapfilefd.flush() |
|
145 | self.mapfilefd.flush() | |
143 |
|
146 | |||
144 | def writeauthormap(self): |
|
147 | def writeauthormap(self): | |
145 | if self.writeauthors == True and len(self.authors) > 0 and hasattr(self.dest, 'authorfile'): |
|
148 | authorfile = self.authorfile | |
146 | authorfile = self.dest.authorfile() |
|
149 | if authorfile: | |
147 | self.ui.status('Writing author map file %s\n' % authorfile) |
|
150 | self.ui.status('Writing author map file %s\n' % authorfile) | |
148 | ofile = open(authorfile, 'w+') |
|
151 | ofile = open(authorfile, 'w+') | |
149 | for author in self.authors: |
|
152 | for author in self.authors: | |
@@ -151,28 +154,24 b' class convert(object):' | |||||
151 | ofile.close() |
|
154 | ofile.close() | |
152 |
|
155 | |||
153 | def readauthormap(self, authorfile): |
|
156 | def readauthormap(self, authorfile): | |
154 | try: |
|
157 | afile = open(authorfile, 'r') | |
155 | afile = open(authorfile, 'r') |
|
158 | for line in afile: | |
156 |
|
|
159 | try: | |
157 | try: |
|
160 | srcauthor = line.split('=')[0].strip() | |
158 |
|
|
161 | dstauthor = line.split('=')[1].strip() | |
159 | dstauthor = line.split('=')[1].strip() |
|
162 | if srcauthor in self.authors and dstauthor != self.authors[srcauthor]: | |
160 | if srcauthor in self.authors and dstauthor != self.authors[srcauthor]: |
|
163 | self.ui.status( | |
161 | self.ui.status( |
|
164 | 'Overriding mapping for author %s, was %s, will be %s\n' | |
162 | 'Overriding mapping for author %s, was %s, will be %s\n' |
|
165 | % (srcauthor, self.authors[srcauthor], dstauthor)) | |
163 | % (srcauthor, self.authors[srcauthor], dstauthor)) |
|
166 | else: | |
164 | else: |
|
167 | self.ui.debug('Mapping author %s to %s\n' | |
165 | self.ui.debug('Mapping author %s to %s\n' |
|
168 | % (srcauthor, dstauthor)) | |
166 | % (srcauthor, dstauthor)) |
|
|||
167 | self.authors[srcauthor] = dstauthor |
|
169 | self.authors[srcauthor] = dstauthor | |
168 |
|
170 | except IndexError: | ||
169 | except IndexError: |
|
171 | self.ui.warn( | |
170 | self.ui.warn( |
|
172 | 'Ignoring bad line in author file map %s: %s\n' | |
171 | 'Ignoring bad line in author file map %s: %s\n' |
|
173 | % (authorfile, line)) | |
172 | % (authorfile, line)) |
|
174 | afile.close() | |
173 | afile.close() |
|
|||
174 | except IOError: |
|
|||
175 | self.ui.warn('Error reading author file map %s.\n' % authorfile) |
|
|||
176 |
|
175 | |||
177 | def copy(self, rev): |
|
176 | def copy(self, rev): | |
178 | c = self.commitcache[rev] |
|
177 | c = self.commitcache[rev] |
@@ -66,7 +66,7 b' class converter_sink(object):' | |||||
66 | """Path to a file that will contain lines |
|
66 | """Path to a file that will contain lines | |
67 | srcauthor=dstauthor |
|
67 | srcauthor=dstauthor | |
68 | mapping equivalent authors identifiers for each system.""" |
|
68 | mapping equivalent authors identifiers for each system.""" | |
69 | raise NotImplementedError() |
|
69 | return None | |
70 |
|
70 | |||
71 | def putfile(self, f, e, data): |
|
71 | def putfile(self, f, e, data): | |
72 | """Put file for next putcommit(). |
|
72 | """Put file for next putcommit(). |
General Comments 0
You need to be logged in to leave comments.
Login now