[Bug 5224] New: hg import from a repo subdirectory should imply `--prefix .`

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Fri Apr 29 17:21:33 UTC 2016


https://bz.mercurial-scm.org/show_bug.cgi?id=5224

            Bug ID: 5224
           Summary: hg import from a repo subdirectory should imply
                    `--prefix .`
           Product: Mercurial
           Version: 3.8-rc
          Hardware: Macintosh
                OS: Mac OS
            Status: UNCONFIRMED
          Severity: feature
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at selenic.com
          Reporter: beng at fb.com
                CC: mercurial-devel at selenic.com

I'm trying to cross-port a patch between two mostly-similar repositories which
have a directory structure like:

foo/bar/my-lib
baz/bar/my-lib

I used `hg export` to export the commit from the first repository, then ran:

% cd /path/to/baz/bar
% hg import -p 2 /path/to/patch

The import failed with the error:

  unable to find 'my-lib/file1' for patching

even though 'my-lib/file1' existed from my current directory.

Eventually, I figured out the problem was that `hg import` implicitly runs from
the root of the repository. With trial and error and help from a few experts,
we found that the correct command was:

% cd /path/to/baz/bar
% hg import -p 2 --prefix . /path/to/patch

For the Principle of Least Astonishment, I think it'd be really nice if `hg
import` when run from a subdirectory of the repo root implied `--prefix .`.
Then it'd behave more like `patch`.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list