[Bug 5521] New: kwexpand / kwshrink: want a --force option

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Apr 4 22:37:45 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5521

            Bug ID: 5521
           Summary: kwexpand / kwshrink: want a --force option
           Product: Mercurial
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: keyword
          Assignee: bugzilla at mercurial-scm.org
          Reporter: r8yo1b03 at sneakemail.com
                CC: blacktrash at gmx.net, mercurial-devel at mercurial-scm.org

Currently if you use kwexpand on a file and that file doesn't have unexpanded
keywords that match your expansion template, you get 'abort: outstanding
uncommitted changes'.  I'd like a way to force the expansion in that case.

example:

cat > testkw << eof
hg init foo
cd foo
echo '$KW$' > x
hg ci -Am0 x
hg --config keyword.'*'= --config extensions.hgext.keyword= --config
keywordmaps.KW='{file} {node|short} {date|utcdate} {author|user}' kwexpand x
cat x
hg --config keyword.'*'= --config extensions.hgext.keyword= --config
keywordmaps.KW='{file} {node|short} {date|utcdate} {author|user}' kwshrink x
echo '$KW manual/cruft $' > x
cat x
hg --config keyword.'*'= --config extensions.hgext.keyword= --config
keywordmaps.KW='{file} {node|short} {date|utcdate} {author|user}' kwexpand x
eof

sh -x testkw
+ hg init foo
+ cd foo
+ echo '$KW$'
+ hg ci -Am0 x
+ hg --config 'keyword.*=' --config extensions.hgext.keyword= --config
'keywordmaps.KW={file} {node|short} {date|utcdate} {author|user}' kwexpand x
+ cat x
$KW: x 946614f451c8 2017/04/04 22:33:11 jhein $
+ hg --config 'keyword.*=' --config extensions.hgext.keyword= --config
'keywordmaps.KW={file} {node|short} {date|utcdate} {author|user}' kwshrink x
+ echo '$KW manual/cruft $'
+  cat x
$KW manual/cruft $
+ hg --config 'keyword.*=' --config extensions.hgext.keyword= --config
'keywordmaps.KW={file} {node|short} {date|utcdate} {author|user}' kwexpand x
abort: outstanding uncommitted changes


I've wanted this for a while, but haven't had the chops to fashion a patch.

Does this seem like a reasonable option for keyword?

Might there be any gotchas to be wary of in the implementation of a --force?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list