[Bug 5436] New: Grafting changes to a new file in a renamed directory loses copy information

bugzilla at mercurial-scm.org bugzilla at mercurial-scm.org
Fri Dec 2 05:30:13 EST 2016


            Bug ID: 5436
           Summary: Grafting changes to a new file in a renamed directory
                    loses copy information
           Product: Mercurial
           Version: 4.0
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: normal
         Component: Mercurial
          Assignee: bugzilla at selenic.com
          Reporter: gabor.stefanik at nng.com
                CC: mercurial-devel at selenic.com

If a new file is created in a directory, and then the commit creating that file
is grafted onto a branch where the directory is renamed, no copy information is
recorded in the graft. When someone then tries to graft subsequent changes to
that new file, Hg fails to find the target, and prompts to recreate the file
under its original filename.

Script to reproduce:
  $ hg init test
  $ cd test
  $ mkdir a
  $ echo a > a/a
  $ hg ci -qAma
  $ echo x > a/x
  $ hg ci -qAmx
  $ hg up -q 0
  $ hg mv -q a b
  $ hg ci -qAmb
  $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
  $ hg up -q 1
  $ echo y > a/x
  $ hg ci -qAmy
  $ hg up -q 3
  $ hg graft -q 4 # prompts to recreate a/x, fails to find b/x

Possible fixes:
- Record some kind of copy information when grafting a new file into a renamed
- Before prompting to recreate a file during a graft, detect renamed
directories in the graft target

The first option is faster, but will only work for new grafts. The second one
would work also for existing new-file grafts, but at the cost of slowing down

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

More information about the Mercurial-devel mailing list