<div dir="ltr">I have no idea how but i sent this patch two times, so ignore second message</div><div class="gmail_extra"><br><div class="gmail_quote">2016-09-05 22:24 GMT+02:00 liscju <span dir="ltr"><<a href="mailto:piotr.listkiewicz@gmail.com" target="_blank">piotr.listkiewicz@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"># HG changeset patch<br>
# User liscju <<a href="mailto:piotr.listkiewicz@gmail.com">piotr.listkiewicz@gmail.com</a>><br>
# Date 1472208500 -7200<br>
#      Fri Aug 26 12:48:20 2016 +0200<br>
# Node ID 63cb64dd80730bc01503b2f28bd159<wbr>535301f649<br>
# Parent  b1809f5d7630a3fff0fa715bbd30db<wbr>a0f07672a8<br>
import: report directory-relative paths in error messages (issue5224)<br>
<br>
Import uses paths relative to the root of the repository, so when<br>
user imports patch with paths relative to the current working directory<br>
import aborts with 'unable to find file for patching'.<br>
<br>
This patch improves this situation by warning the user that paths are<br>
relative to the root of repository when patching fails.<br>
<br>
diff --git a/mercurial/patch.py b/mercurial/patch.py<br>
--- a/mercurial/patch.py<br>
+++ b/mercurial/patch.py<br>
@@ -669,6 +669,8 @@ class patchfile(object):<br>
                 self.mode = (False, False)<br>
         if self.missing:<br>
             self.ui.warn(_("unable to find '%s' for patching\n") % self.fname)<br>
+            self.ui.warn(_("(use '--prefix' to apply patch relative to the "<br>
+                           "current directory)\n"))<br>
<br>
         self.hash = {}<br>
         self.dirty = 0<br>
diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t<br>
--- a/tests/test-import-bypass.t<br>
+++ b/tests/test-import-bypass.t<br>
@@ -41,6 +41,7 @@ Test failure without --exact<br>
   $ hg import --bypass ../test.diff<br>
   applying ../test.diff<br>
   unable to find 'a' for patching<br>
+  (use '--prefix' to apply patch relative to the current directory)<br>
   abort: patch failed to apply<br>
   [255]<br>
   $ hg st<br>
diff --git a/tests/test-import.t b/tests/test-import.t<br>
--- a/tests/test-import.t<br>
+++ b/tests/test-import.t<br>
@@ -1623,6 +1623,7 @@ Importing with unknown file:<br>
   $ hg export --rev 'desc("extended jungle")' | hg import --partial -<br>
   applying patch from stdin<br>
   unable to find 'jungle' for patching<br>
+  (use '--prefix' to apply patch relative to the current directory)<br>
   1 out of 1 hunks FAILED -- saving rejects to file jungle.rej<br>
   patch applied partially<br>
   (fix the .rej files and run `hg commit --amend`)<br>
@@ -1764,3 +1765,31 @@ Importing some extra header<br>
   $ hg log --debug -r . | grep extra<br>
   extra:       branch=default<br>
   extra:       foo=bar<br>
+<br>
+Warn the user that paths are relative to the root of<br>
+repository when file not found for patching<br>
+<br>
+  $ mkdir filedir<br>
+  $ echo "file1" >> filedir/file1<br>
+  $ hg add filedir/file1<br>
+  $ hg commit -m "file1"<br>
+  $ cd filedir<br>
+  $ hg import -p 2 - <<EOF<br>
+  > # HG changeset patch<br>
+  > # User test<br>
+  > # Date 0 0<br>
+  > file2<br>
+  ><br>
+  > diff --git a/filedir/file1 b/filedir/file1<br>
+  > --- a/filedir/file1<br>
+  > +++ b/filedir/file1<br>
+  > @@ -1,1 +1,2 @@<br>
+  >  file1<br>
+  > +file2<br>
+  > EOF<br>
+  applying patch from stdin<br>
+  unable to find 'file1' for patching<br>
+  (use '--prefix' to apply patch relative to the current directory)<br>
+  1 out of 1 hunks FAILED -- saving rejects to file file1.rej<br>
+  abort: patch failed to apply<br>
+  [255]<br>
diff --git a/tests/test-mq-missingfiles.t b/tests/test-mq-missingfiles.t<br>
--- a/tests/test-mq-missingfiles.t<br>
+++ b/tests/test-mq-missingfiles.t<br>
@@ -42,6 +42,7 @@ Push patch with missing target:<br>
   $ hg qpush<br>
   applying changeb<br>
   unable to find 'b' for patching<br>
+  (use '--prefix' to apply patch relative to the current directory)<br>
   2 out of 2 hunks FAILED -- saving rejects to file b.rej<br>
   patch failed, unable to continue (try -v)<br>
   patch failed, rejects left in working directory<br>
@@ -147,6 +148,7 @@ Push git patch with missing target:<br>
   $ hg qpush<br>
   applying changeb<br>
   unable to find 'b' for patching<br>
+  (use '--prefix' to apply patch relative to the current directory)<br>
   1 out of 1 hunks FAILED -- saving rejects to file b.rej<br>
   patch failed, unable to continue (try -v)<br>
   patch failed, rejects left in working directory<br>
</div></div></blockquote></div><br></div>