##// END OF EJS Templates
keyword: compact setting of optional arguments
Christian Ebert -
r6504:1be53f93 default
parent child Browse files
Show More
@@ -128,7 +128,7 b' class kwtemplater(object):'
128
128
129 kwmaps = self.ui.configitems('keywordmaps')
129 kwmaps = self.ui.configitems('keywordmaps')
130 if kwmaps: # override default templates
130 if kwmaps: # override default templates
131 kwmaps = [(k, templater.parsestring(v, quoted=False))
131 kwmaps = [(k, templater.parsestring(v, False))
132 for (k, v) in kwmaps]
132 for (k, v) in kwmaps]
133 self.templates = dict(kwmaps)
133 self.templates = dict(kwmaps)
134 escaped = map(re.escape, self.templates.keys())
134 escaped = map(re.escape, self.templates.keys())
@@ -241,7 +241,7 b' class kwfilelog(filelog.filelog):'
241 def add(self, text, meta, tr, link, p1=None, p2=None):
241 def add(self, text, meta, tr, link, p1=None, p2=None):
242 '''Removes keyword substitutions when adding to filelog.'''
242 '''Removes keyword substitutions when adding to filelog.'''
243 text = self.kwt.shrink(self.path, text)
243 text = self.kwt.shrink(self.path, text)
244 return super(kwfilelog, self).add(text, meta, tr, link, p1=p1, p2=p2)
244 return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
245
245
246 def cmp(self, node, text):
246 def cmp(self, node, text):
247 '''Removes keyword substitutions for comparison.'''
247 '''Removes keyword substitutions for comparison.'''
@@ -302,7 +302,7 b' def demo(ui, repo, *args, **opts):'
302 branchname = 'demobranch'
302 branchname = 'demobranch'
303 tmpdir = tempfile.mkdtemp('', 'kwdemo.')
303 tmpdir = tempfile.mkdtemp('', 'kwdemo.')
304 ui.note(_('creating temporary repo at %s\n') % tmpdir)
304 ui.note(_('creating temporary repo at %s\n') % tmpdir)
305 repo = localrepo.localrepository(ui, path=tmpdir, create=True)
305 repo = localrepo.localrepository(ui, tmpdir, True)
306 ui.setconfig('keyword', fn, '')
306 ui.setconfig('keyword', fn, '')
307 if args or opts.get('rcfile'):
307 if args or opts.get('rcfile'):
308 kwstatus = 'custom'
308 kwstatus = 'custom'
@@ -481,20 +481,17 b' def reposetup(ui, repo):'
481 else:
481 else:
482 _p2 = hex(_p2)
482 _p2 = hex(_p2)
483
483
484 node = super(kwrepo,
484 n = super(kwrepo, self).commit(files, text, user, date, match,
485 self).commit(files=files, text=text, user=user,
485 force, force_editor, p1, p2,
486 date=date, match=match, force=force,
486 extra, empty_ok)
487 force_editor=force_editor,
488 p1=p1, p2=p2, extra=extra,
489 empty_ok=empty_ok)
490
487
491 # restore commit hooks
488 # restore commit hooks
492 for name, cmd in commithooks.iteritems():
489 for name, cmd in commithooks.iteritems():
493 ui.setconfig('hooks', name, cmd)
490 ui.setconfig('hooks', name, cmd)
494 if node is not None:
491 if n is not None:
495 kwt.overwrite(node=node)
492 kwt.overwrite(node=n)
496 repo.hook('commit', node=node, parent1=_p1, parent2=_p2)
493 repo.hook('commit', node=n, parent1=_p1, parent2=_p2)
497 return node
494 return n
498 finally:
495 finally:
499 del wlock, lock
496 del wlock, lock
500
497
@@ -502,7 +499,7 b' def reposetup(ui, repo):'
502 def kwpatchfile_init(self, ui, fname, missing=False):
499 def kwpatchfile_init(self, ui, fname, missing=False):
503 '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
500 '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
504 rejects or conflicts due to expanded keywords in working dir.'''
501 rejects or conflicts due to expanded keywords in working dir.'''
505 patchfile_init(self, ui, fname, missing=missing)
502 patchfile_init(self, ui, fname, missing)
506 # shrink keywords read from working dir
503 # shrink keywords read from working dir
507 self.lines = kwt.shrinklines(self.fname, self.lines)
504 self.lines = kwt.shrinklines(self.fname, self.lines)
508
505
@@ -514,8 +511,7 b' def reposetup(ui, repo):'
514 kwt.matcher = util.never
511 kwt.matcher = util.never
515 elif node1 is not None and node1 != repo.changectx().node():
512 elif node1 is not None and node1 != repo.changectx().node():
516 kwt.restrict = True
513 kwt.restrict = True
517 patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
514 patch_diff(repo, node1, node2, files, match, fp, changes, opts)
518 fp=fp, changes=changes, opts=opts)
519
515
520 def kwweb_changeset(web, req, tmpl):
516 def kwweb_changeset(web, req, tmpl):
521 '''Wraps webcommands.changeset turning off keyword expansion.'''
517 '''Wraps webcommands.changeset turning off keyword expansion.'''
General Comments 0
You need to be logged in to leave comments. Login now