Mercurial > hg
comparison hgext/keyword.py @ 5885:53be157543d4
keyword: avoid extra diffs when not comparing against working dir
When diffing against specified revisions expanded keywords
only get in the way.
Update test output.
author | Christian Ebert <blacktrash@gmx.net> |
---|---|
date | Tue, 15 Jan 2008 14:39:53 +0100 |
parents | a139f141dcae |
children | d0576d065993 |
comparison
equal
deleted
inserted
replaced
5884:a139f141dcae | 5885:53be157543d4 |
---|---|
92 | 92 |
93 def _kwrestrict(cmd): | 93 def _kwrestrict(cmd): |
94 '''Returns True if cmd should trigger restricted expansion. | 94 '''Returns True if cmd should trigger restricted expansion. |
95 Keywords will only expanded when writing to working dir. | 95 Keywords will only expanded when writing to working dir. |
96 Crucial for mq as expanded keywords should not make it into patches.''' | 96 Crucial for mq as expanded keywords should not make it into patches.''' |
97 return cmd in ('qimport', 'qnew', 'qpush', 'qrefresh', 'record', 'qrecord') | 97 return cmd in ('diff1', |
98 'qimport', 'qnew', 'qpush', 'qrefresh', 'record', 'qrecord') | |
98 | 99 |
99 | 100 |
100 _kwtemplater = None | 101 _kwtemplater = None |
101 | 102 |
102 class kwtemplater(object): | 103 class kwtemplater(object): |
417 'convert') | 418 'convert') |
418 hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:]) | 419 hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:]) |
419 if hgcmd in nokwcommands: | 420 if hgcmd in nokwcommands: |
420 return | 421 return |
421 | 422 |
423 if hgcmd == 'diff': | |
424 # only expand if comparing against working dir | |
425 node1, node2 = cmdutil.revpair(repo, cmdopts.get('rev')) | |
426 if node2 is not None: | |
427 return | |
428 # shrink if rev is not current node | |
429 if node1 is not None and node1 != repo.changectx().node(): | |
430 hgcmd = 'diff1' | |
431 | |
422 inc, exc = [], ['.hgtags'] | 432 inc, exc = [], ['.hgtags'] |
423 for pat, opt in ui.configitems('keyword'): | 433 for pat, opt in ui.configitems('keyword'): |
424 if opt != 'ignore': | 434 if opt != 'ignore': |
425 inc.append(pat) | 435 inc.append(pat) |
426 else: | 436 else: |