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 " 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 < y + > y + > n + > EOF + diff --git a/foo.h b/foo.h + new file mode 100644 + examine changes to 'foo.h'? [Ynesfdaq?] y +