D5792: uncommit: added interactive mode(issue6062)
taapas1128 (Taapas Agrawal)
phabricator at mercurial-scm.org
Fri Feb 1 07:39:07 UTC 2019
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5792
AFFECTED FILES
hgext/uncommit.py
tests/test-uncommit.t
CHANGE DETAILS
diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t
--- a/tests/test-uncommit.t
+++ b/tests/test-uncommit.t
@@ -1,6 +1,8 @@
Test uncommit - set up the config
$ cat >> $HGRCPATH <<EOF
+ > [ui]
+ > interactive = true
> [experimental]
> evolution.createmarkers=True
> evolution.allowunstable=True
@@ -34,6 +36,7 @@
options ([+] can be repeated):
+ -i --interactive use interactive mode
--keep allow an empty commit after uncommiting
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
@@ -398,3 +401,17 @@
|/
o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
+Test for interactive mode
+ $ hg init repo3
+ $ touch x
+ $ hg add x
+ $ hg commit -m "added x"
+ $ hg uncommit -i<<EOF
+ > y
+ > EOF
+ diff --git a/x b/x
+ new file mode 100644
+ examine changes to 'x'? [Ynesfdaq?] y
+
+ abort: empty commit message
+ [255]
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -136,7 +136,8 @@
ds.copy(src, dst)
@command('uncommit',
- [('', 'keep', False, _('allow an empty commit after uncommiting')),
+ [('i', 'interactive', None, _('use interactive mode')),
+ ('', 'keep', False, _('allow an empty commit after uncommiting')),
] + commands.walkopts,
_('[OPTION]... [FILE]...'),
helpcategory=command.CATEGORY_CHANGE_MANAGEMENT)
@@ -151,6 +152,7 @@
If no files are specified, the commit will be pruned, unless --keep is
given.
"""
+
opts = pycompat.byteskwargs(opts)
with repo.wlock(), repo.lock():
@@ -186,6 +188,11 @@
s = old.p1().status(old, match=match)
_fixdirstate(repo, old, repo[newid], s)
+ if opts.get(r'interactive'):
+ opts.pop(r'interactive')
+ ret = cmdutil.dorecord(ui, repo, commands.commit, None, False,
+ cmdutil.recordfilter, *pats,
+ **opts)
def predecessormarkers(ctx):
"""yields the obsolete markers marking the given changeset as a successor"""
for data in ctx.repo().obsstore.predecessors.get(ctx.node(), ()):
To: taapas1128, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list