--- a/hgkw/keyword.py Wed Apr 09 13:40:16 2008 +0200
+++ b/hgkw/keyword.py Wed May 14 02:25:52 2008 +0200
@@ -171,6 +171,12 @@
except AttributeError:
return f
+'''Default match argument for commit, depending on version.'''
+if hasattr(cmdutil, 'match'):
+ _defmatch = None
+else:
+ _defmatch = util.always
+
# commands.parse/cmdutil.parse returned nothing for
# "hg diff --rev" before 88803a69b24a due to bug in fancyopts
def _fancyopts(args, options, state):
@@ -390,8 +396,13 @@
'''Bails out if [keyword] configuration is not active.
Returns status of working directory.'''
if kwt:
- files, match, anypats = cmdutil.matchpats(repo, pats, opts)
- return repo.status(files=files, match=match, list_clean=True)
+ try:
+ # 0159b7a36184 ff.
+ matcher = cmdutil.match(repo, pats, opts)
+ return repo.status(match=matcher, list_clean=True)
+ except AttributeError:
+ files, match, anypats = cmdutil.matchpats(repo, pats, opts)
+ return repo.status(files=files, match=match, list_clean=True)
if ui.configitems('keyword'):
raise util.Abort(_('[keyword] patterns cannot match'))
raise util.Abort(_('no [keyword] patterns configured'))
@@ -607,7 +618,7 @@
p1=p1, p2=p2, extra=extra)
def commit(self, files=None, text='', user=None, date=None,
- match=util.always, force=False, lock=None, wlock=None,
+ match=_defmatch, force=False, lock=None, wlock=None,
force_editor=False, p1=None, p2=None, extra={},
empty_ok=False):
# (w)lock arguments removed in 126f527b3ba3
@@ -673,14 +684,17 @@
except AttributeError:
pass
- def kw_diff(repo, node1=None, node2=None, files=None, match=util.always,
+ def kw_diff(repo, node1=None, node2=None, files=None, match=_defmatch,
fp=None, changes=None, opts=None):
# only expand if comparing against working dir
if node2 is not None:
kwt.matcher = util.never
elif node1 is not None and node1 != repo.changectx().node():
kwt.restrict = True
- patch_diff(repo, node1, node2, files, match, fp, changes, opts)
+ try:
+ patch_diff(repo, node1, node2, files, match, fp, changes, opts)
+ except TypeError:
+ patch_diff(repo, node1, node2, match, fp, changes, opts)
patch_diff = patch.diff
patch.diff = kw_diff