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