mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
strip: add --keep flag to avoid modifying wc during strip
Fixes issue1564.
This commit is contained in:
parent
2187fcb2bb
commit
35723d1610
20
hgext/mq.py
20
hgext/mq.py
@ -2522,7 +2522,18 @@ def strip(ui, repo, *revs, **opts):
|
||||
del q.applied[start:end]
|
||||
q.save_dirty()
|
||||
|
||||
repo.mq.strip(repo, list(rootnodes), backup=backup, update=update,
|
||||
revs = list(rootnodes)
|
||||
if update and opts.get('keep'):
|
||||
wlock = repo.wlock()
|
||||
try:
|
||||
urev = repo.mq.qparents(repo, revs[0])
|
||||
repo.dirstate.rebuild(urev, repo[urev].manifest())
|
||||
repo.dirstate.write()
|
||||
update = False
|
||||
finally:
|
||||
wlock.release()
|
||||
|
||||
repo.mq.strip(repo, revs, backup=backup, update=update,
|
||||
force=opts.get('force'))
|
||||
return 0
|
||||
|
||||
@ -3145,9 +3156,10 @@ cmdtable = {
|
||||
('b', 'backup', None, _('bundle only changesets with local revision'
|
||||
' number greater than REV which are not'
|
||||
' descendants of REV (DEPRECATED)')),
|
||||
('n', 'no-backup', None, _('no backups')),
|
||||
('', 'nobackup', None, _('no backups (DEPRECATED)'))],
|
||||
_('hg strip [-f] [-n] REV...')),
|
||||
('n', 'no-backup', None, _('no backups')),
|
||||
('', 'nobackup', None, _('no backups (DEPRECATED)')),
|
||||
('k', 'keep', None, _("do not modify working copy during strip"))],
|
||||
_('hg strip [-k] [-f] [-n] REV...')),
|
||||
"qtop": (top, [] + seriesopts, _('hg qtop [-s]')),
|
||||
"qunapplied":
|
||||
(unapplied,
|
||||
|
@ -380,3 +380,39 @@ stripping ancestor of queue
|
||||
applied patches after stripping ancestor of queue
|
||||
|
||||
$ hg qapplied
|
||||
|
||||
Verify strip protects against stripping wc parent when there are uncommited mods
|
||||
|
||||
$ echo b > b
|
||||
$ hg add b
|
||||
$ hg ci -m 'b'
|
||||
$ hg log --graph
|
||||
@ changeset: 1:7519abd79d14
|
||||
| tag: tip
|
||||
| user: test
|
||||
| date: Thu Jan 01 00:00:00 1970 +0000
|
||||
| summary: b
|
||||
|
|
||||
o changeset: 0:9ab35a2d17cb
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: a
|
||||
|
||||
|
||||
$ echo c > b
|
||||
$ echo c > bar
|
||||
$ hg strip tip
|
||||
abort: local changes found
|
||||
[255]
|
||||
$ hg strip tip --keep
|
||||
saved backup bundle to * (glob)
|
||||
$ hg log --graph
|
||||
@ changeset: 0:9ab35a2d17cb
|
||||
tag: tip
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: a
|
||||
|
||||
$ hg status
|
||||
M bar
|
||||
? b
|
||||
|
Loading…
Reference in New Issue
Block a user