Mercurial > hgsubversion
changeset 820:09f7c1c09207
authormap: only append new or changed authors
Previously, specifying an extra authormap with the
hgsubversion.authormap configuration variable would cause the entirety
of the other authormap to be appended to the one in '.hg/svn/authors'
on each subversion access (e.g. hg in/out/pull/push).
This also changes the authormap to preserve comments and the like in
the authormap file.
author | maugustin <maugustin@gmx.net> |
---|---|
date | Sat, 23 Jul 2011 19:33:50 -0500 |
parents | e30ff6d5feff |
children | f28e0f54a6ef |
files | hgsubversion/maps.py |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/maps.py +++ b/hgsubversion/maps.py @@ -45,12 +45,9 @@ class AuthorMap(dict): self.ui.note('reading authormap from %s\n' % path) f = open(path, 'r') - for number, line in enumerate(f): + for number, line_org in enumerate(f): - if writing: - writing.write(line) - - line = line.split('#')[0] + line = line_org.split('#')[0] if not line.strip(): continue @@ -63,10 +60,15 @@ class AuthorMap(dict): src = src.strip() dst = dst.strip() - self.ui.debug('adding author %s to author map\n' % src) - if src in self and dst != self[src]: - msg = 'overriding author: "%s" to "%s" (%s)\n' - self.ui.status(msg % (self[src], dst, src)) + + if writing: + if not src in self: + self.ui.debug('adding author %s to author map\n' % src) + elif dst != self[src]: + msg = 'overriding author: "%s" to "%s" (%s)\n' + self.ui.status(msg % (self[src], dst, src)) + writing.write(line_org) + self[src] = dst f.close()