D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)

navaneeth.suresh (Navaneeth Suresh) phabricator at mercurial-scm.org
Thu Mar 14 02:21:29 EDT 2019


navaneeth.suresh updated this revision to Diff 14492.
navaneeth.suresh retitled this revision from "patch: stop aborting when ADD/RENAME/COPY files on --interactive (issue5727)" to "patch: stop aborting when add/rename/copy files on --interactive (issue5727)".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6056?vs=14319&id=14492

REVISION DETAIL
  https://phab.mercurial-scm.org/D6056

AFFECTED FILES
  mercurial/patch.py
  tests/test-mq-qrefresh.t

CHANGE DETAILS

diff --git a/tests/test-mq-qrefresh.t b/tests/test-mq-qrefresh.t
--- a/tests/test-mq-qrefresh.t
+++ b/tests/test-mq-qrefresh.t
@@ -550,3 +550,22 @@
   2: secret
 
   $ cd ..
+
+Interactive qrefresh should not abort if files have been added
+
+  $ hg init issue5727
+  $ cd issue5727
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo 'record =' >> $HGRCPATH
+  $ hg qnew -m "BugId: 0 add foo.h" foo.diff
+  $ touch foo.h
+  $ hg add foo.h
+  $ hg qrefresh -i --config ui.interactive=true <<EOF
+  > y
+  > y
+  > n
+  > EOF
+  diff --git a/foo.h b/foo.h
+  new file mode 100644
+  examine changes to 'foo.h'? [Ynesfdaq?] y
+  
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2065,7 +2065,7 @@
                         # Added files without content have no hunk and
                         # must be created
                         data = ''
-                if data or mode:
+                if data or (mode and not ui.interactive()):
                     if (gp.op in ('ADD', 'RENAME', 'COPY')
                         and backend.exists(gp.path)):
                         raise PatchError(_("cannot create %s: destination "



To: navaneeth.suresh, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list