Bug 310 - strip blows away modifications to the working directory
Summary: strip blows away modifications to the working directory
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: normal bug
Assignee: Chris Mason
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-11 22:09 UTC by Bryan O'Sullivan
Modified: 2011-04-30 02:00 UTC (History)
6 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan O'Sullivan 2006-07-11 22:09 UTC
I just noticed that the strip command destroys any modifications outstanding in
the working directory, and not in a good way.  For example, I "hg add"ed a file,
and it got removed.  Eep!

It should presumably barf if there are pending changes, but even if passed a -f
flag, it should at most *forget* added files etc, not outright delete them.
Comment 1 Jeremy Fitzhardinge 2006-07-12 18:37 UTC
This looks related to http://www.serpentine.com/bugzilla/show_bug.cgi?id=296 which I posted a couple of weeks ago.  
Perhaps strip shouldn't touch the working directory at all?
Comment 2 Benoit Boissinot 2006-07-13 16:26 UTC
It should probably abort with outstanding modifications if the rev is included
in the stripped revs (otherwise we shouldn't care)
Comment 3 Benoit Boissinot 2006-09-26 16:06 UTC
should be fixed by f8bcaf5696d5761e823a821b48fbf7bf1f0ad94a
Comment 4 Thomas Arendsen Hein 2006-09-27 00:44 UTC
tested with main
Comment 5 Eric Haszlakiewicz 2010-05-12 14:13 UTC
It shouldn't do anything with local changes.  IMO, the following sequence of
operations should work the same with or without the explicit "hg update" step:

hg init repo1
cd repo1
echo foo > foo
hg add foo
hg ci -m rev1
echo bar >> foo
hg ci -m rev2
echo groo >> foo  # change the file, but don't commit it
# Without this, strip throws away changes:
hg update -r 0
hg strip -f 1
Comment 6 Eric Haszlakiewicz 2010-05-12 14:19 UTC
fwiw, I just tried this with hg 1.5.2, and it still throws away working
directory changes.
Comment 7 HG Bot 2011-04-30 02:00 UTC
Fixed by http://selenic.com/repo/hg/rev/4f19242dac6c
Patrick Mezard <pmezard@gmail.com>
strip: make it clear that --force discards changes (issue310)

(please test the fix)
Comment 8 Bugzilla 2012-05-12 08:32 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 08:32 EDT  ---

This bug was previously known as _bug_ 310 at http://mercurial.selenic.com/bts/issue310