241 return self.kwt.expand(self.path, node, data) |
241 return self.kwt.expand(self.path, node, data) |
242 |
242 |
243 def add(self, text, meta, tr, link, p1=None, p2=None): |
243 def add(self, text, meta, tr, link, p1=None, p2=None): |
244 '''Removes keyword substitutions when adding to filelog.''' |
244 '''Removes keyword substitutions when adding to filelog.''' |
245 text = self.kwt.shrink(self.path, text) |
245 text = self.kwt.shrink(self.path, text) |
246 return super(kwfilelog, self).add(text, meta, tr, link, p1=p1, p2=p2) |
246 return super(kwfilelog, self).add(text, meta, tr, link, p1, p2) |
247 |
247 |
248 def cmp(self, node, text): |
248 def cmp(self, node, text): |
249 '''Removes keyword substitutions for comparison.''' |
249 '''Removes keyword substitutions for comparison.''' |
250 text = self.kwt.shrink(self.path, text) |
250 text = self.kwt.shrink(self.path, text) |
251 if self.renamed(node): |
251 if self.renamed(node): |
481 if _p2 == nullid: |
481 if _p2 == nullid: |
482 _p2 = '' |
482 _p2 = '' |
483 else: |
483 else: |
484 _p2 = hex(_p2) |
484 _p2 = hex(_p2) |
485 |
485 |
486 node = super(kwrepo, |
486 n = super(kwrepo, self).commit(files, text, user, date, match, |
487 self).commit(files=files, text=text, user=user, |
487 force, force_editor, p1, p2, |
488 date=date, match=match, force=force, |
488 extra, empty_ok) |
489 force_editor=force_editor, |
|
490 p1=p1, p2=p2, extra=extra, |
|
491 empty_ok=empty_ok) |
|
492 |
489 |
493 # restore commit hooks |
490 # restore commit hooks |
494 for name, cmd in commithooks.iteritems(): |
491 for name, cmd in commithooks.iteritems(): |
495 ui.setconfig('hooks', name, cmd) |
492 ui.setconfig('hooks', name, cmd) |
496 if node is not None: |
493 if n is not None: |
497 kwt.overwrite(node=node) |
494 kwt.overwrite(node=n) |
498 repo.hook('commit', node=node, parent1=_p1, parent2=_p2) |
495 repo.hook('commit', node=n, parent1=_p1, parent2=_p2) |
499 return node |
496 return n |
500 finally: |
497 finally: |
501 del wlock, lock |
498 del wlock, lock |
502 |
499 |
503 # monkeypatches |
500 # monkeypatches |
504 def kwpatchfile_init(self, ui, fname, missing=False): |
501 def kwpatchfile_init(self, ui, fname, missing=False): |
505 '''Monkeypatch/wrap patch.patchfile.__init__ to avoid |
502 '''Monkeypatch/wrap patch.patchfile.__init__ to avoid |
506 rejects or conflicts due to expanded keywords in working dir.''' |
503 rejects or conflicts due to expanded keywords in working dir.''' |
507 patchfile_init(self, ui, fname, missing=missing) |
504 patchfile_init(self, ui, fname, missing) |
508 # shrink keywords read from working dir |
505 # shrink keywords read from working dir |
509 self.lines = kwt.shrinklines(self.fname, self.lines) |
506 self.lines = kwt.shrinklines(self.fname, self.lines) |
510 |
507 |
511 def kw_diff(repo, node1=None, node2=None, files=None, match=util.always, |
508 def kw_diff(repo, node1=None, node2=None, files=None, match=util.always, |
512 fp=None, changes=None, opts=None): |
509 fp=None, changes=None, opts=None): |
514 comparing against working dir.''' |
511 comparing against working dir.''' |
515 if node2 is not None: |
512 if node2 is not None: |
516 kwt.matcher = util.never |
513 kwt.matcher = util.never |
517 elif node1 is not None and node1 != repo.changectx().node(): |
514 elif node1 is not None and node1 != repo.changectx().node(): |
518 kwt.restrict = True |
515 kwt.restrict = True |
519 patch_diff(repo, node1=node1, node2=node2, files=files, match=match, |
516 patch_diff(repo, node1, node2, files, match, fp, changes, opts) |
520 fp=fp, changes=changes, opts=opts) |
|
521 |
517 |
522 def kwweb_changeset(web, req, tmpl): |
518 def kwweb_changeset(web, req, tmpl): |
523 '''Wraps webcommands.changeset turning off keyword expansion.''' |
519 '''Wraps webcommands.changeset turning off keyword expansion.''' |
524 kwt.matcher = util.never |
520 kwt.matcher = util.never |
525 return webcommands_changeset(web, req, tmpl) |
521 return webcommands_changeset(web, req, tmpl) |