##// END OF EJS Templates
keyword: obtain kwtemplater instance via repository at runtime...
FUJIWARA Katsunori -
r33068:a15da610 default
parent child Browse files
Show More
@@ -671,6 +671,8 b' def reposetup(ui, repo):'
671 671 '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
672 672 rejects or conflicts due to expanded keywords in working dir.'''
673 673 orig(self, ui, gp, backend, store, eolmode)
674 kwt = getattr(getattr(backend, 'repo', None), '_keywordkwt', None)
675 if kwt:
674 676 # shrink keywords read from working dir
675 677 self.lines = kwt.shrinklines(self.fname, self.lines)
676 678
@@ -696,6 +698,9 b' def reposetup(ui, repo):'
696 698
697 699 def kw_amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
698 700 '''Wraps cmdutil.amend expanding keywords after amend.'''
701 kwt = getattr(repo, '_keywordkwt', None)
702 if kwt is None:
703 return orig(ui, repo, commitfunc, old, extra, pats, opts)
699 704 with repo.wlock():
700 705 kwt.postcommit = True
701 706 newid = orig(ui, repo, commitfunc, old, extra, pats, opts)
@@ -716,6 +721,9 b' def reposetup(ui, repo):'
716 721 For the latter we have to follow the symlink to find out whether its
717 722 target is configured for expansion and we therefore must unexpand the
718 723 keywords in the destination.'''
724 kwt = getattr(repo, '_keywordkwt', None)
725 if kwt is None:
726 return orig(ui, repo, pats, opts, rename)
719 727 with repo.wlock():
720 728 orig(ui, repo, pats, opts, rename)
721 729 if opts.get('dry_run'):
@@ -739,6 +747,9 b' def reposetup(ui, repo):'
739 747
740 748 def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts):
741 749 '''Wraps record.dorecord expanding keywords after recording.'''
750 kwt = getattr(repo, '_keywordkwt', None)
751 if kwt is None:
752 return orig(ui, repo, commitfunc, *pats, **opts)
742 753 with repo.wlock():
743 754 # record returns 0 even when nothing has changed
744 755 # therefore compare nodes before and after
@@ -758,6 +769,9 b' def reposetup(ui, repo):'
758 769 def kwfilectx_cmp(orig, self, fctx):
759 770 if fctx._customcmp:
760 771 return fctx.cmp(self)
772 kwt = getattr(self._repo, '_keywordkwt', None)
773 if kwt is None:
774 return orig(self, fctx)
761 775 # keyword affects data size, comparing wdir and filelog size does
762 776 # not make sense
763 777 if (fctx._filenode is None and
General Comments 0
You need to be logged in to leave comments. Login now