Mercurial > hgsubversion
comparison hg_delta_editor.py @ 181:e37f9d3fd5e7
remove decorators (compat with python2.3)
| author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
|---|---|
| date | Tue, 13 Jan 2009 13:59:50 +0100 |
| parents | a336e3e82648 |
| children | 6266ba36ee15 |
comparison
equal
deleted
inserted
replaced
| 180:3f1e8a5ec9dd | 181:e37f9d3fd5e7 |
|---|---|
| 630 self.ui.warn( | 630 self.ui.warn( |
| 631 ('Ignoring bad line in filemap %s: %s\n') | 631 ('Ignoring bad line in filemap %s: %s\n') |
| 632 % (filemapfile, line.rstrip())) | 632 % (filemapfile, line.rstrip())) |
| 633 f.close() | 633 f.close() |
| 634 | 634 |
| 635 @property | |
| 636 def meta_data_dir(self): | 635 def meta_data_dir(self): |
| 637 return os.path.join(self.path, '.hg', 'svn') | 636 return os.path.join(self.path, '.hg', 'svn') |
| 637 meta_data_dir = property(meta_data_dir) | |
| 638 | 638 |
| 639 def meta_file_named(self, name): | 639 def meta_file_named(self, name): |
| 640 return os.path.join(self.meta_data_dir, name) | 640 return os.path.join(self.meta_data_dir, name) |
| 641 | 641 |
| 642 @property | |
| 643 def revmap_file(self): | 642 def revmap_file(self): |
| 644 return self.meta_file_named('rev_map') | 643 return self.meta_file_named('rev_map') |
| 645 | 644 revmap_file = property(revmap_file) |
| 646 @property | 645 |
| 647 def svn_url_file(self): | 646 def svn_url_file(self): |
| 648 return self.meta_file_named('url') | 647 return self.meta_file_named('url') |
| 649 | 648 svn_url_file = property(svn_url_file) |
| 650 @property | 649 |
| 651 def uuid_file(self): | 650 def uuid_file(self): |
| 652 return self.meta_file_named('uuid') | 651 return self.meta_file_named('uuid') |
| 653 | 652 uuid_file = property(uuid_file) |
| 654 @property | 653 |
| 655 def last_revision_handled_file(self): | 654 def last_revision_handled_file(self): |
| 656 return self.meta_file_named('last_rev') | 655 return self.meta_file_named('last_rev') |
| 657 | 656 last_revision_handled_file = property(last_revision_handled_file) |
| 658 @property | 657 |
| 659 def branch_info_file(self): | 658 def branch_info_file(self): |
| 660 return self.meta_file_named('branch_info') | 659 return self.meta_file_named('branch_info') |
| 661 | 660 branch_info_file = property(branch_info_file) |
| 662 @property | 661 |
| 663 def tag_info_file(self): | 662 def tag_info_file(self): |
| 664 return self.meta_file_named('tag_info') | 663 return self.meta_file_named('tag_info') |
| 665 | 664 tag_info_file = property(tag_info_file) |
| 666 @property | 665 |
| 667 def tag_locations_file(self): | 666 def tag_locations_file(self): |
| 668 return self.meta_file_named('tag_locations') | 667 return self.meta_file_named('tag_locations') |
| 669 | 668 tag_locations_file = property(tag_locations_file) |
| 670 @property | 669 |
| 671 def url(self): | 670 def url(self): |
| 672 return open(self.svn_url_file).read() | 671 return open(self.svn_url_file).read() |
| 673 | 672 url = property(url) |
| 674 @property | 673 |
| 675 def authors_file(self): | 674 def authors_file(self): |
| 676 return self.meta_file_named('authors') | 675 return self.meta_file_named('authors') |
| 677 | 676 authors_file = property(authors_file) |
| 678 @stash_exception_on_self | 677 |
| 679 def delete_entry(self, path, revision_bogus, parent_baton, pool=None): | 678 def delete_entry(self, path, revision_bogus, parent_baton, pool=None): |
| 680 br_path, branch = self._path_and_branch_for_path(path) | 679 br_path, branch = self._path_and_branch_for_path(path) |
| 681 if br_path == '': | 680 if br_path == '': |
| 682 self.branches_to_delete.add(branch) | 681 self.branches_to_delete.add(branch) |
| 683 if br_path is not None: | 682 if br_path is not None: |
| 698 for f in ctx.walk(our_util.PrefixMatch(br_path2)): | 697 for f in ctx.walk(our_util.PrefixMatch(br_path2)): |
| 699 f_p = '%s/%s' % (path, f[len(br_path2):]) | 698 f_p = '%s/%s' % (path, f[len(br_path2):]) |
| 700 if f_p not in self.current_files: | 699 if f_p not in self.current_files: |
| 701 self.delete_file(f_p) | 700 self.delete_file(f_p) |
| 702 self.delete_file(path) | 701 self.delete_file(path) |
| 703 | 702 delete_entry = stash_exception_on_self(delete_entry) |
| 704 @stash_exception_on_self | 703 |
| 705 def open_file(self, path, parent_baton, base_revision, p=None): | 704 def open_file(self, path, parent_baton, base_revision, p=None): |
| 706 self.current_file = 'foobaz' | 705 self.current_file = 'foobaz' |
| 707 fpath, branch = self._path_and_branch_for_path(path) | 706 fpath, branch = self._path_and_branch_for_path(path) |
| 708 if fpath: | 707 if fpath: |
| 709 self.current_file = path | 708 self.current_file = path |
| 711 if base_revision != -1: | 710 if base_revision != -1: |
| 712 self.base_revision = base_revision | 711 self.base_revision = base_revision |
| 713 else: | 712 else: |
| 714 self.base_revision = None | 713 self.base_revision = None |
| 715 self.should_edit_most_recent_plaintext = True | 714 self.should_edit_most_recent_plaintext = True |
| 715 open_file = stash_exception_on_self(open_file) | |
| 716 | 716 |
| 717 def aresamefiles(self, parentctx, childctx, files): | 717 def aresamefiles(self, parentctx, childctx, files): |
| 718 """Assuming all files exist in childctx and parentctx, return True | 718 """Assuming all files exist in childctx and parentctx, return True |
| 719 if none of them was changed in-between. | 719 if none of them was changed in-between. |
| 720 """ | 720 """ |
| 736 if f in files: | 736 if f in files: |
| 737 return False | 737 return False |
| 738 # parentctx is not an ancestor of childctx, files are unrelated | 738 # parentctx is not an ancestor of childctx, files are unrelated |
| 739 return False | 739 return False |
| 740 | 740 |
| 741 @stash_exception_on_self | |
| 742 def add_file(self, path, parent_baton, copyfrom_path, | 741 def add_file(self, path, parent_baton, copyfrom_path, |
| 743 copyfrom_revision, file_pool=None): | 742 copyfrom_revision, file_pool=None): |
| 744 self.current_file = 'foobaz' | 743 self.current_file = 'foobaz' |
| 745 self.base_revision = None | 744 self.base_revision = None |
| 746 if path in self.deleted_files: | 745 if path in self.deleted_files: |
| 772 branch) | 771 branch) |
| 773 if parentid != revlog.nullid: | 772 if parentid != revlog.nullid: |
| 774 parentctx = self.repo.changectx(parentid) | 773 parentctx = self.repo.changectx(parentid) |
| 775 if self.aresamefiles(parentctx, ctx, [from_file]): | 774 if self.aresamefiles(parentctx, ctx, [from_file]): |
| 776 self.copies[path] = from_file | 775 self.copies[path] = from_file |
| 777 | 776 add_file = stash_exception_on_self(add_file) |
| 778 @stash_exception_on_self | 777 |
| 779 def add_directory(self, path, parent_baton, copyfrom_path, | 778 def add_directory(self, path, parent_baton, copyfrom_path, |
| 780 copyfrom_revision, dir_pool=None): | 779 copyfrom_revision, dir_pool=None): |
| 781 self.dir_batons[path] = path | 780 self.dir_batons[path] = path |
| 782 br_path, branch = self._path_and_branch_for_path(path) | 781 br_path, branch = self._path_and_branch_for_path(path) |
| 783 if br_path is not None: | 782 if br_path is not None: |
| 830 if parentid != revlog.nullid: | 829 if parentid != revlog.nullid: |
| 831 parentctx = self.repo.changectx(parentid) | 830 parentctx = self.repo.changectx(parentid) |
| 832 if self.aresamefiles(parentctx, cp_f_ctx, copies.values()): | 831 if self.aresamefiles(parentctx, cp_f_ctx, copies.values()): |
| 833 self.copies.update(copies) | 832 self.copies.update(copies) |
| 834 return path | 833 return path |
| 835 | 834 add_directory = stash_exception_on_self(add_directory) |
| 836 @stash_exception_on_self | 835 |
| 837 def change_file_prop(self, file_baton, name, value, pool=None): | 836 def change_file_prop(self, file_baton, name, value, pool=None): |
| 838 if name == 'svn:executable': | 837 if name == 'svn:executable': |
| 839 self.current_files_exec[self.current_file] = bool(value is not None) | 838 self.current_files_exec[self.current_file] = bool(value is not None) |
| 840 elif name == 'svn:special': | 839 elif name == 'svn:special': |
| 841 self.current_files_symlink[self.current_file] = bool(value is not None) | 840 self.current_files_symlink[self.current_file] = bool(value is not None) |
| 842 | 841 change_file_prop = stash_exception_on_self(change_file_prop) |
| 843 @stash_exception_on_self | 842 |
| 844 def change_dir_prop(self, dir_baton, name, value, pool=None): | 843 def change_dir_prop(self, dir_baton, name, value, pool=None): |
| 845 if dir_baton is None: | 844 if dir_baton is None: |
| 846 return | 845 return |
| 847 path = self.dir_batons[dir_baton] | 846 path = self.dir_batons[dir_baton] |
| 848 if name == 'svn:externals': | 847 if name == 'svn:externals': |
| 849 self.externals[path] = value | 848 self.externals[path] = value |
| 850 | 849 change_dir_prop = stash_exception_on_self(change_dir_prop) |
| 851 @stash_exception_on_self | 850 |
| 852 def open_directory(self, path, parent_baton, base_revision, dir_pool=None): | 851 def open_directory(self, path, parent_baton, base_revision, dir_pool=None): |
| 853 self.dir_batons[path] = path | 852 self.dir_batons[path] = path |
| 854 p_, branch = self._path_and_branch_for_path(path) | 853 p_, branch = self._path_and_branch_for_path(path) |
| 855 if p_ == '': | 854 if p_ == '': |
| 856 self.commit_branches_empty[branch] = False | 855 self.commit_branches_empty[branch] = False |
| 857 return path | 856 return path |
| 858 | 857 open_directory = stash_exception_on_self(open_directory) |
| 859 @stash_exception_on_self | 858 |
| 860 def close_directory(self, dir_baton, dir_pool=None): | 859 def close_directory(self, dir_baton, dir_pool=None): |
| 861 if dir_baton is not None: | 860 if dir_baton is not None: |
| 862 del self.dir_batons[dir_baton] | 861 del self.dir_batons[dir_baton] |
| 863 | 862 close_directory = stash_exception_on_self(close_directory) |
| 864 @stash_exception_on_self | 863 |
| 865 def apply_textdelta(self, file_baton, base_checksum, pool=None): | 864 def apply_textdelta(self, file_baton, base_checksum, pool=None): |
| 866 base = '' | 865 base = '' |
| 867 if not self._is_path_valid(self.current_file): | 866 if not self._is_path_valid(self.current_file): |
| 868 return lambda x: None | 867 return lambda x: None |
| 869 if (self.current_file in self.current_files | 868 if (self.current_file in self.current_files |
| 911 except: #pragma: no cover | 910 except: #pragma: no cover |
| 912 print len(base), self.current_file | 911 print len(base), self.current_file |
| 913 self._exception_info = sys.exc_info() | 912 self._exception_info = sys.exc_info() |
| 914 raise | 913 raise |
| 915 return txdelt_window | 914 return txdelt_window |
| 915 apply_textdelta = stash_exception_on_self(apply_textdelta) | |
| 916 | 916 |
| 917 class MissingPlainTextError(Exception): | 917 class MissingPlainTextError(Exception): |
| 918 """Exception raised when the repo lacks a source file required for replaying | 918 """Exception raised when the repo lacks a source file required for replaying |
| 919 a txdelta. | 919 a txdelta. |
| 920 """ | 920 """ |
