Files Vanish If Deleted Before Committing a Merge
Jensen, Aaron
ajensen at webmd.net
Fri Apr 27 23:39:29 UTC 2012
Windows 7 x64, Mercurial 2.1.1.
We've noticed that during a merge, if I delete a file (i.e. using `rm file`) Mercurial removes that file from the repository. There is no record of the file's removal.
Add a file to the default branch. Merge that changeset into another branch. Delete the new file (i.e. `rm file`) from the file system. Commit the merge. The file is no longer in the branch's manifest. The log command doesn't show the file being deleted. However, when merging back to default, the file is removed and shows as removed by the log command. My transcript shows this and other strange behavior [1].
I would expect Mercurial to abort the commit with a warning that a file is missing. Is the behavior I'm seeing by design?
I observe similar behavior when committing an added file that gets deleted [2].
<:> Aaron
[1] Detailed steps to reproduce:
$ hg init vanish
$ cd vanish
$ '' > file
$ hg add file
$ hg commit -m "commit"
$ hg branch ByeBye
marked working directory as branch ByeBye
(branches are permanent and global, did you want a bookmark?)
$ 'a' > file
$ hg commit -m .
$ hg up default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ '' > file2
$ hg add file2
$ hg commit -m .
$ hg up ByeBye
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg merge default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ rm file2
$ hg st
! file2
$ hg commit -m "Merge"
$ hg st
! file2
$ hg manifest
file
$ hg up -C
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg st
$ hg manifest .
file
$ hg log -r tip --debug
changeset: 3:f2ea3a777e066e57e8871555097ba4a438ebb965
branch: ByeBye
phase: draft
parent: 1:0163b8f985307d27788c3ed7621f6d7fb1644713
parent: 2:ac6e8f768a50a4134167b63f1f5e4d902618c8db
manifest: 1:53488d621bbd64a1d94d7ab5ff0e65b28f61c377
user: Aaron Jensen <ajensen at webmd.net>
date: Fri Apr 27 16:05:53 2012 -0700
extra: branch=ByeBye
description:
Merge
$ hg manifest default
file
file2
$ hg up default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg merge ByeBye
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg st
M file
R file2
$ hg commit -m "Merge"
$ hg log -r tip --debug
changeset: 4:423225544166efecfebdb7753fb787207d847dfa
tag: tip
phase: draft
parent: 2:ac6e8f768a50a4134167b63f1f5e4d902618c8db
parent: 3:f2ea3a777e066e57e8871555097ba4a438ebb965
manifest: 3:6e065e75f2215faab18838302cf8832360186c5c
user: Aaron Jensen <ajensen at webmd.net>
date: Fri Apr 27 16:10:33 2012 -0700
files: file
files-: file2
extra: branch=default
description:
Merge
$ hg manifest default
file
[2] Similar problem adding a deleted file:
$ '' > file3
$ hg add file3
$ rm file3
$ hg st
! file3
$ hg commit -m "adding file"
nothing changed (1 missing files, see 'hg status')
$ '' > file4
$ hg add file4
$ hg commit -m "adding file"
$ hg st
! file3
$ hg manifest
file
file4
$ hg log --debug -r tip
changeset: 5:c40266aca324f7eb8769dfe6f7bb56f4ca098576
tag: tip
phase: draft
parent: 4:423225544166efecfebdb7753fb787207d847dfa
parent: -1:0000000000000000000000000000000000000000
manifest: 4:bc238bdab886db77c16161344a47f68919a7dc43
user: Aaron Jensen <ajensen at webmd.net>
date: Fri Apr 27 16:22:54 2012 -0700
files+: file4
extra: branch=default
description:
adding file
$ hg st
! file3
$ hg up
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg st
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20120427/1cee5bbb/attachment-0002.html>
More information about the Mercurial
mailing list