D5792: uncommit: added interactive mode(issue6062)

taapas1128 (Taapas Agrawal) phabricator at mercurial-scm.org
Fri Feb 1 02:42:23 EST 2019


taapas1128 updated this revision to Diff 13669.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5792?vs=13668&id=13669

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)
@@ -186,6 +187,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