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

login
register
mail settings
Submitter phabricator
Date March 14, 2019, 6:21 a.m.
Message ID <45f11fecc641b9da7edbc8dc124d3472@localhost.localdomain>
Download mbox | patch
Permalink /patch/39246/
State Not Applicable
Headers show

Comments

phabricator - March 14, 2019, 6:21 a.m.
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




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

Patch

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 "