Bug 2450 - hg up --check discards unversioned files
Summary: hg up --check discards unversioned files
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-21 13:18 UTC by David Grellscheid
Modified: 2012-05-13 04:52 UTC (History)
7 users (show)

See Also:
Python Version: ---


Attachments
(34 bytes, application/x-sh)
2010-10-21 13:18 UTC, David Grellscheid
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Grellscheid 2010-10-21 13:18 UTC
If I read the help page for 'hg up' correctly, the '--check' option should
abort when uncommitted changes are encountered. With hg 1.6.4 on both OS X
and Linux, however, '--check' overwrites unversioned files with a versioned
copy if they happen to have the same name.

With an unversioned file, I would expect the following:
'hg up': abort
'hg up --check': abort
'hg up --clean': overwrite

Actually, what happens is:
'hg up': abort
'hg up --check': overwrite (!)
'hg up --clean': overwrite


Please see the attached shell script for a minimal test case.
Comment 1 kiilerix 2010-10-21 13:48 UTC
Unified test:
  $ hg init foo
  $ echo foo > foo/file
  $ hg -R foo ci -Am'foo'
  adding file

create non-repo dir in bar
  $ mkdir bar
  $ echo bar > bar/file # same filename as in foo

try to retrofit repo into bar
  $ hg init bar
  $ hg -R bar pull -q foo

  $ hg -R bar up # aborts with 'untracked file'
  abort: untracked file in working directory differs from file in requested
revision: 'file'
  [255]

  $ hg -R bar up --check # replaces uncommitted file with hg copy!
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ cat {foo,bar}/file
  foo
  foo
Comment 2 kiilerix 2011-06-09 15:56 UTC
Copy nosy from Issue2845
Comment 3 HG Bot 2012-02-10 14:00 UTC
Fixed by http://selenic.com/repo/hg/rev/914bc95e227b
Matt Mackall <mpm@selenic.com>
update: use normal update path with --check (issue2450)

(please test the fix)
Comment 4 Bugzilla 2012-05-12 09:13 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:13 EDT  ---

This bug was previously known as _bug_ 2450 at http://mercurial.selenic.com/bts/issue2450
Imported an attachment (id=1474)