[Bug 4297] New: sparse Extension Deletes Modified Files on Merge

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Mon Jul 7 12:36:28 CDT 2014


http://bz.selenic.com/show_bug.cgi?id=4297

          Priority: normal
            Bug ID: 4297
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: sparse Extension Deletes Modified Files on Merge
          Severity: bug
    Classification: Unclassified
                OS: Windows
          Reporter: baltic at hypersw.net
          Hardware: PC
            Status: UNCONFIRMED
           Version: 3.0.1
         Component: Mercurial
           Product: Mercurial

Merges with a sparse working copy are destructive for excluded files whose
modifications are being merged in.

Not only are the changes dropped, but the file removal is committed into repo,
so the file is now deleted even from a non-sparse WC.

According to
http://permalink.gmane.org/gmane.comp.version-control.mercurial.devel/69389 it
should seem that conflicted merges would be aborted (feels a right thing to
do), but merges without conflicts in excluded files should supposedly be OK.
Instead, if you're merging files changed by smb else, you're silently deleting
such files altogether.

Example scenario:
* You have file "two.txt" in repo, in all branches.
* Somebody modifies this file in a feature branch.
* You have a sparse working copy which excludes this file, and you're merging
that feature branch into default.
=> Your merge silently deletes the file "two.txt".

Demo script for this scenario (WinNT / PowerShell, but mostly HG commands
anyway):

###################################################
$repo = "t:\HgSample"
rmdir -Recurse -Force "$repo\*" | Out-Null
mkdir $repo -Force | Out-Null
cd $repo
hg init

# Initial files
"One!" | Out-File "$repo\one.txt"
"Two!" | Out-File "$repo\two.txt"
hg add
hg commit -m initial-files

# Feature branch
hg branch feature-branch
"Two More!" | Out-File "$repo\two.txt"
hg commit -m updated-files

# Sparse'd default
hg update default
hg sparse --exclude "two**"

# Merge feature branch, kills file
hg merge feature-branch
hg commit -m merged-feature

# Unsparse and see no file
hg sparse --reset
" "
"Files in dir:"
"$repo" | ls | foreach Name

# action="R" in log
hg log --style xml --debug -l 1
#################################################

Output: only "one.txt", file "two.txt" is missing.
The log lists <path action="R">two.txt</path> in merge commit.

PS no tracker component for this ext yet, so I chose core Mercurial, sorry.

PPS 
Happy that the sparse extension is finally out there. Looks very promising for
our HG usage scenario.

We got around 15 repos (some of them with, like, 130000 files, WC size 2GB plus
.hg/store of 5GB). Each product has a combination of them linked as subrepos,
which turns out to be a subrepo hell at times. We're considering merging them
into one single repo, which should be quite bearable with help of "share" and
"sparse" extensions. With "sparse", each product could be seeing a relevant
part of the repo and skipping the performance penalty of updating and
status'ing the unneeded files.

However, this relies on merges still working on sparse working copies! We use
branches a lot and merge often. If you have to unsprase to have even a
non-conflicting merge, this basically kills the whole idea. Sparse-unsparse
would be painfully slow on it.

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


More information about the Mercurial-devel mailing list