Mercurial > hgsubversion
comparison hg_delta_editor.py @ 186:6266ba36ee15
Create patch to make normal output much less verboseā¦
author | Dan Villiom Podlaski Christiansen <danchr@cs.au.dk> |
---|---|
date | Sat, 17 Jan 2009 15:30:38 -0600 |
parents | e37f9d3fd5e7 |
children | 43d56e973c3c |
comparison
equal
deleted
inserted
replaced
185:57355b0e7bd1 | 186:6266ba36ee15 |
---|---|
219 def delete_file(self, path): | 219 def delete_file(self, path): |
220 self.deleted_files[path] = True | 220 self.deleted_files[path] = True |
221 self.current_files[path] = '' | 221 self.current_files[path] = '' |
222 self.current_files_exec[path] = False | 222 self.current_files_exec[path] = False |
223 self.current_files_symlink[path] = False | 223 self.current_files_symlink[path] = False |
224 self.ui.status('D %s\n' % path) | 224 self.ui.note('D %s\n' % path) |
225 | 225 |
226 def _normalize_path(self, path): | 226 def _normalize_path(self, path): |
227 '''Normalize a path to strip of leading slashes and our subdir if we | 227 '''Normalize a path to strip of leading slashes and our subdir if we |
228 have one. | 228 have one. |
229 ''' | 229 ''' |
523 filectxfn, | 523 filectxfn, |
524 self.authorforsvnauthor(rev.author), | 524 self.authorforsvnauthor(rev.author), |
525 date, | 525 date, |
526 extra) | 526 extra) |
527 new_hash = self.repo.commitctx(current_ctx) | 527 new_hash = self.repo.commitctx(current_ctx) |
528 self.ui.status('committed as %s on branch %s\n' % | 528 |
529 (node.hex(new_hash), (branch or 'default'))) | 529 self.ui.status(our_util.describe_commit(new_hash, branch)) |
530 if (rev.revnum, branch) not in self.revmap: | 530 if (rev.revnum, branch) not in self.revmap: |
531 self.add_to_revmap(rev.revnum, branch, new_hash) | 531 self.add_to_revmap(rev.revnum, branch, new_hash) |
532 # now we handle branches that need to be committed without any files | 532 # now we handle branches that need to be committed without any files |
533 for branch in self.commit_branches_empty: | 533 for branch in self.commit_branches_empty: |
534 ha = self.get_parent_revision(rev.revnum, branch) | 534 ha = self.get_parent_revision(rev.revnum, branch) |
550 del_all_files, | 550 del_all_files, |
551 self.authorforsvnauthor(rev.author), | 551 self.authorforsvnauthor(rev.author), |
552 date, | 552 date, |
553 extra) | 553 extra) |
554 new_hash = self.repo.commitctx(current_ctx) | 554 new_hash = self.repo.commitctx(current_ctx) |
555 self.ui.status('committed as %s on branch %s\n' % | 555 self.ui.status(our_util.describe_commit(new_hash, branch)) |
556 (node.hex(new_hash), (branch or 'default'))) | |
557 if (rev.revnum, branch) not in self.revmap: | 556 if (rev.revnum, branch) not in self.revmap: |
558 self.add_to_revmap(rev.revnum, branch, new_hash) | 557 self.add_to_revmap(rev.revnum, branch, new_hash) |
559 self.clear_current_info() | 558 self.clear_current_info() |
560 | 559 |
561 def authorforsvnauthor(self, author): | 560 def authorforsvnauthor(self, author): |
562 if(author in self.authors): | 561 if(author in self.authors): |
563 return self.authors[author] | 562 return self.authors[author] |
564 return '%s%s' %(author, self.author_host) | 563 return '%s%s' %(author, self.author_host) |
565 | 564 |
566 def readauthors(self, authorfile): | 565 def readauthors(self, authorfile): |
567 self.ui.status( | 566 self.ui.note(('Reading authormap from %s\n') % authorfile) |
568 ('Reading authormap %s\n') | |
569 % authorfile) | |
570 f = open(authorfile, 'r') | 567 f = open(authorfile, 'r') |
571 for line in f: | 568 for line in f: |
572 if not line.strip(): | 569 if not line.strip(): |
573 continue | 570 continue |
574 try: | 571 try: |
575 srcauth, dstauth = line.split('=', 1) | 572 srcauth, dstauth = line.split('=', 1) |
576 srcauth = srcauth.strip() | 573 srcauth = srcauth.strip() |
577 dstauth = dstauth.strip() | 574 dstauth = dstauth.strip() |
578 if srcauth in self.authors and dstauth != self.authors[srcauth]: | 575 if srcauth in self.authors and dstauth != self.authors[srcauth]: |
579 self.ui.status( | 576 self.ui.status(('Overriding author mapping for "%s" ' + |
580 ('Overriding mapping for author %s, was %s, now %s\n') | 577 'from "%s" to "%s"\n') |
581 % (srcauth, self.authors[srcauth], dstauth)) | 578 % (srcauth, self.authors[srcauth], dstauth)) |
582 else: | 579 else: |
583 self.ui.debug(('Mapping author %s to %s\n') | 580 self.ui.debug(('Mapping author "%s" to "%s"\n') |
584 % (srcauth, dstauth)) | 581 % (srcauth, dstauth)) |
585 self.authors[srcauth] = dstauth | 582 self.authors[srcauth] = dstauth |
586 except IndexError: | 583 except IndexError: |
587 self.ui.warn( | 584 self.ui.warn( |
588 ('Ignoring bad line in author map file %s: %s\n') | 585 ('Ignoring bad line in author map file %s: %s\n') |
589 % (authorfile, line.rstrip())) | 586 % (authorfile, line.rstrip())) |
590 f.close() | 587 f.close() |
591 | 588 |
592 def writeauthors(self): | 589 def writeauthors(self): |
590 self.ui.debug(('Writing author map to %s\n') % self.authors_file) | |
593 f = open(self.authors_file, 'w+') | 591 f = open(self.authors_file, 'w+') |
594 self.ui.status( | |
595 ('Writing author map file %s\n') | |
596 % self.authors_file) | |
597 for author in self.authors: | 592 for author in self.authors: |
598 f.write("%s=%s\n" % (author, self.authors[author])) | 593 f.write("%s=%s\n" % (author, self.authors[author])) |
599 f.close() | 594 f.close() |
600 | 595 |
601 def readfilemap(self, filemapfile): | 596 def readfilemap(self, filemapfile): |
602 self.ui.status( | 597 self.ui.note( |
603 ('Reading filemap %s\n') | 598 ('Reading file map from %s\n') |
604 % filemapfile) | 599 % filemapfile) |
605 def addpathtomap(path, mapping, mapname): | 600 def addpathtomap(path, mapping, mapname): |
606 if path in mapping: | 601 if path in mapping: |
607 self.ui.warn( | 602 self.ui.warn(('Duplicate %s entry in %s: "%d"\n') % |
608 ('%d alreading in %s list\n') | 603 (mapname, filemapfile, path)) |
609 % (path, mapname)) | |
610 else: | 604 else: |
605 self.ui.debug(('%sing %s\n') % | |
606 (mapname.capitalize().strip('e'), path)) | |
611 mapping[path] = path | 607 mapping[path] = path |
612 | 608 |
613 f = open(filemapfile, 'r') | 609 f = open(filemapfile, 'r') |
614 for line in f: | 610 for line in f: |
615 if line.strip() == '': | 611 if line.strip() == '' or line.strip()[0] == '#': |
616 continue | 612 continue |
617 try: | 613 try: |
618 cmd, path = line.split(' ', 1) | 614 cmd, path = line.split(' ', 1) |
619 cmd = cmd.strip() | 615 cmd = cmd.strip() |
620 path = path.strip() | 616 path = path.strip() |
704 def open_file(self, path, parent_baton, base_revision, p=None): | 700 def open_file(self, path, parent_baton, base_revision, p=None): |
705 self.current_file = 'foobaz' | 701 self.current_file = 'foobaz' |
706 fpath, branch = self._path_and_branch_for_path(path) | 702 fpath, branch = self._path_and_branch_for_path(path) |
707 if fpath: | 703 if fpath: |
708 self.current_file = path | 704 self.current_file = path |
709 self.ui.status('M %s\n' % path) | 705 self.ui.note('M %s\n' % path) |
710 if base_revision != -1: | 706 if base_revision != -1: |
711 self.base_revision = base_revision | 707 self.base_revision = base_revision |
712 else: | 708 else: |
713 self.base_revision = None | 709 self.base_revision = None |
714 self.should_edit_most_recent_plaintext = True | 710 self.should_edit_most_recent_plaintext = True |
748 if not fpath: | 744 if not fpath: |
749 return | 745 return |
750 self.current_file = path | 746 self.current_file = path |
751 self.should_edit_most_recent_plaintext = False | 747 self.should_edit_most_recent_plaintext = False |
752 if not copyfrom_path: | 748 if not copyfrom_path: |
753 self.ui.status('A %s\n' % path) | 749 self.ui.note('A %s\n' % path) |
754 return | 750 return |
755 self.ui.status('A+ %s\n' % path) | 751 self.ui.note('A+ %s\n' % path) |
756 (from_file, | 752 (from_file, |
757 from_branch) = self._path_and_branch_for_path(copyfrom_path) | 753 from_branch) = self._path_and_branch_for_path(copyfrom_path) |
758 if not from_file: | 754 if not from_file: |
759 self.missing_plaintexts.add(path) | 755 self.missing_plaintexts.add(path) |
760 return | 756 return |