356 fp.write(data) |
356 fp.write(data) |
357 fp.close() |
357 fp.close() |
358 if kwcmd: |
358 if kwcmd: |
359 self.repo.dirstate.set_clean(f) |
359 self.repo.dirstate.set_clean(f) |
360 elif self.postcommit: |
360 elif self.postcommit: |
361 self.repo.dirstate.normallookup(f) |
361 self.repo.dirstate.update_file_p1(f, p1_tracked=True) |
362 |
362 |
363 def shrink(self, fname, text): |
363 def shrink(self, fname, text): |
364 '''Returns text with all keyword substitutions removed.''' |
364 '''Returns text with all keyword substitutions removed.''' |
365 if self.match(fname) and not stringutil.binary(text): |
365 if self.match(fname) and not stringutil.binary(text): |
366 return _shrinktext(text, self.rekwexp.sub) |
366 return _shrinktext(text, self.rekwexp.sub) |
689 def kw_amend(orig, ui, repo, old, extra, pats, opts): |
689 def kw_amend(orig, ui, repo, old, extra, pats, opts): |
690 '''Wraps cmdutil.amend expanding keywords after amend.''' |
690 '''Wraps cmdutil.amend expanding keywords after amend.''' |
691 kwt = getattr(repo, '_keywordkwt', None) |
691 kwt = getattr(repo, '_keywordkwt', None) |
692 if kwt is None: |
692 if kwt is None: |
693 return orig(ui, repo, old, extra, pats, opts) |
693 return orig(ui, repo, old, extra, pats, opts) |
694 with repo.wlock(): |
694 with repo.wlock(), repo.dirstate.parentchange(): |
695 kwt.postcommit = True |
695 kwt.postcommit = True |
696 newid = orig(ui, repo, old, extra, pats, opts) |
696 newid = orig(ui, repo, old, extra, pats, opts) |
697 if newid != old.node(): |
697 if newid != old.node(): |
698 ctx = repo[newid] |
698 ctx = repo[newid] |
699 kwt.restrict = True |
699 kwt.restrict = True |
755 ret = orig(ui, repo, commitfunc, *pats, **opts) |
755 ret = orig(ui, repo, commitfunc, *pats, **opts) |
756 recctx = repo[b'.'] |
756 recctx = repo[b'.'] |
757 if ctx != recctx: |
757 if ctx != recctx: |
758 modified, added = _preselect(wstatus, recctx.files()) |
758 modified, added = _preselect(wstatus, recctx.files()) |
759 kwt.restrict = False |
759 kwt.restrict = False |
760 kwt.overwrite(recctx, modified, False, True) |
760 with repo.dirstate.parentchange(): |
761 kwt.overwrite(recctx, added, False, True, True) |
761 kwt.overwrite(recctx, modified, False, True) |
|
762 kwt.overwrite(recctx, added, False, True, True) |
762 kwt.restrict = True |
763 kwt.restrict = True |
763 return ret |
764 return ret |
764 |
765 |
765 |
766 |
766 def kwfilectx_cmp(orig, self, fctx): |
767 def kwfilectx_cmp(orig, self, fctx): |