comparison hg_delta_editor.py @ 168:4f26fa049452

authormap: Add tests, fix in stupid mode.
author Augie Fackler <durin42@gmail.com>
date Tue, 30 Dec 2008 20:14:03 -0600
parents 3cd6a7354207
children f80132c5fea5
comparison
equal deleted inserted replaced
167:3cd6a7354207 168:4f26fa049452
480 if (rev.revnum, branch) not in self.revmap: 480 if (rev.revnum, branch) not in self.revmap:
481 self.add_to_revmap(rev.revnum, branch, new_hash) 481 self.add_to_revmap(rev.revnum, branch, new_hash)
482 self.clear_current_info() 482 self.clear_current_info()
483 483
484 def authorforsvnauthor(self, author): 484 def authorforsvnauthor(self, author):
485 if(author in self.authors): 485 if(author in self.authors):
486 return self.authors[author] 486 return self.authors[author]
487 return '%s%s' %(author, self.author_host) 487 return '%s%s' %(author, self.author_host)
488 488
489 def readauthors(self, authorfile): 489 def readauthors(self, authorfile):
490 self.ui.status( 490 self.ui.status(
491 ('Reading authormap %s\n') 491 ('Reading authormap %s\n')
492 % authorfile) 492 % authorfile)
493 f = open(authorfile, 'r') 493 f = open(authorfile, 'r')
494 for line in f: 494 for line in f:
495 if line.strip() == '': 495 if not line.strip():
496 continue 496 continue
497 try: 497 try:
498 srcauth, dstauth = line.split('=', 1) 498 srcauth, dstauth = line.split('=', 1)
499 srcauth = srcauth.strip() 499 srcauth = srcauth.strip()
500 dstauth = dstauth.strip() 500 dstauth = dstauth.strip()
509 except IndexError: 509 except IndexError:
510 self.ui.warn( 510 self.ui.warn(
511 ('Ignoring bad line in author map file %s: %s\n') 511 ('Ignoring bad line in author map file %s: %s\n')
512 % (authorfile, line.rstrip())) 512 % (authorfile, line.rstrip()))
513 f.close() 513 f.close()
514 514
515 def writeauthors(self): 515 def writeauthors(self):
516 f = open(self.authors_file, 'w+') 516 f = open(self.authors_file, 'w+')
517 self.ui.status( 517 self.ui.status(
518 ('Writing author map file %s\n') 518 ('Writing author map file %s\n')
519 % self.authors_file) 519 % self.authors_file)
561 return open(self.svn_url_file).read() 561 return open(self.svn_url_file).read()
562 562
563 @property 563 @property
564 def authors_file(self): 564 def authors_file(self):
565 return self.meta_file_named('authors') 565 return self.meta_file_named('authors')
566 566
567 @stash_exception_on_self 567 @stash_exception_on_self
568 def delete_entry(self, path, revision_bogus, parent_baton, pool=None): 568 def delete_entry(self, path, revision_bogus, parent_baton, pool=None):
569 br_path, branch = self._path_and_branch_for_path(path) 569 br_path, branch = self._path_and_branch_for_path(path)
570 if br_path == '': 570 if br_path == '':
571 self.branches_to_delete.add(branch) 571 self.branches_to_delete.add(branch)