[issue3072] Untracked files left behind on directory rename

Martin Geisler bugs at mercurial.selenic.com
Tue Oct 25 04:27:02 CDT 2011

New submission from Martin Geisler <mg at lazybytes.net>:

If I do 'hg rename foo bar', then an untracked file inside foo is not moved.
This is a little unexpected but may be okay by itself. However, when 'hg
merge' detects a directory rename, then it *will* move untracked files.

I prefer to move untracked files in both cases. For reference, Bazaar moves
them in both cases too.

Test case:

  $ hg init
  $ mkdir foo
  $ touch foo/known
  $ hg add
  adding foo/known
  $ hg commit -m added

  $ touch foo/unknown

  $ hg rename foo bar
  moving foo/known to bar/known
  $ hg commit -m rename

The unknown file is left behind on 'hg rename':

  $ ls foo

Now make parallel change and merge:

  $ hg update 0
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ echo change > foo/known
  $ hg commit -m change
  created new head

If we detect a directory rename at merge time, then we move the full

  $ ls

  $ hg merge
  merging foo/known and bar/known to bar/known
  1 files updated, 1 files merged, 0 files removed, 0 files unresolved
  (branch merge, don't forget to commit)

  $ ls
  $ ls bar

messages: 17758
nosy: mg, mpm, parren
priority: feature
status: unread
title: Untracked files left behind on directory rename

Mercurial issue tracker <bugs at mercurial.selenic.com>

More information about the Mercurial-devel mailing list