Bug 5003 - update --clean doesn't work on new branch
Summary: update --clean doesn't work on new branch
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: PC Linux
: normal bug
Assignee: Bugzilla
URL:
Keywords: easy
Depends on:
Blocks:
 
Reported: 2015-12-15 06:21 UTC by Taras Boiko
Modified: 2016-06-14 00:00 UTC (History)
5 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 Taras Boiko 2015-12-15 06:21 UTC
In following scenario 

$ hg branch new-branch
# proceed to edit and add some file
$ hg update --clean # lets nuke edits, i'll run hg add after

result is
abort: branch new-branch not found

Expected result:

Edited files are reverted and added files changed to untracked


Workaround as for now is

$ hg branch --clean
$ hg update --clean
$ hg branch new-branch
Comment 1 Wasim Thabraze 2016-02-29 02:30 UTC
Hello Taras,

I'm interested in working on this bug. Can you please help me in getting started?!


Regards,
Wasim
www.thabraze.me
Comment 2 Pierre-Yves David 2016-02-29 12:30 UTC
Piotr Listkiewicz is already working on a patch: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-February/079944.html
Comment 3 Bugzilla 2016-03-15 00:00 UTC
Bug was set to IN_PROGRESS for 14 days, moving back to confirmed
Comment 4 HG Bot 2016-06-06 17:00 UTC
Fixed by https://selenic.com/repo/hg/rev/1c7167009936
liscju <piotr.listkiewicz@gmail.com>
update: fix bare --clean to work on new branch (issue5003) (BC)

Before this commit bare update --clean on newly created branch
updates to the parent commit, even if there are later commits
on the parent commit's branch. Update to the latest head on the
parent commit's branch instead.

This seems reasonable as clean should discard uncommited changes,
branch is one of them.

(please test the fix)
Comment 5 Bugzilla 2016-06-14 00:00 UTC
Bug was set to TESTING for 7 days, resolving