Submitter | liscju |
---|---|
Date | Aug. 26, 2016, 10:50 a.m. |
Message ID | <e810cc95a9276fd60183.1472208640@liscju-VirtualBox> |
Download | mbox | patch |
Permalink | /patch/16449/ |
State | Changes Requested |
Headers | show |
Comments
On Fri, Aug 26, 2016 at 12:50:40PM +0200, liscju wrote: > # HG changeset patch > # User liscju <piotr.listkiewicz@gmail.com> > # Date 1472208500 -7200 > # Fri Aug 26 12:48:20 2016 +0200 > # Node ID e810cc95a9276fd601834ddbc73c6abbc45b6218 > # Parent b1809f5d7630a3fff0fa715bbd30dba0f07672a8 > import: report directory-relative paths in error messages (issue5224) I like this. I'd encourage finishing the patch. > > Import uses paths relative to the root of the repository, so when > user imports patch with paths relative to the current working directory > import aborts with 'unable to find file for patching'. > > This patch improves this situation by warning the user that paths are > relative to the root of repository when the path exists from > current working directory. > > This patch is not completed, because i don't know if backend is always > specified for patchfile class. backend class is needed to get access > to the repository object(containing getcwd method) and vfs layer. > Another possible solution would be to warn user every time the file > is not found without checking whether file exists. > > diff --git a/mercurial/patch.py b/mercurial/patch.py > --- a/mercurial/patch.py > +++ b/mercurial/patch.py > @@ -669,6 +669,10 @@ class patchfile(object): > self.mode = (False, False) > if self.missing: > self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) > + wvfs = backend.repo.wvfs > + if wvfs.exists(wvfs.reljoin(backend.repo.getcwd(), self.fname)): > + self.ui.warn(_("Note that paths are relative to the root of repository, " > + "use --prefix option to change it\n")) > > self.hash = {} > self.dirty = 0 > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -669,6 +669,10 @@ class patchfile(object): self.mode = (False, False) if self.missing: self.ui.warn(_("unable to find '%s' for patching\n") % self.fname) + wvfs = backend.repo.wvfs + if wvfs.exists(wvfs.reljoin(backend.repo.getcwd(), self.fname)): + self.ui.warn(_("Note that paths are relative to the root of repository, " + "use --prefix option to change it\n")) self.hash = {} self.dirty = 0