##// END OF EJS Templates
mq: add --force option to strip
Dirkjan Ochtman -
r6472:8c4cd80a default
parent child Browse files
Show More
@@ -662,14 +662,14 b' class queue:'
662 finally:
662 finally:
663 del wlock
663 del wlock
664
664
665 def strip(self, repo, rev, update=True, backup="all"):
665 def strip(self, repo, rev, update=True, backup="all", force=None):
666 wlock = lock = None
666 wlock = lock = None
667 try:
667 try:
668 wlock = repo.wlock()
668 wlock = repo.wlock()
669 lock = repo.lock()
669 lock = repo.lock()
670
670
671 if update:
671 if update:
672 self.check_localchanges(repo, refresh=False)
672 self.check_localchanges(repo, force=force, refresh=False)
673 urev = self.qparents(repo, rev)
673 urev = self.qparents(repo, rev)
674 hg.clean(repo, urev)
674 hg.clean(repo, urev)
675 repo.dirstate.write()
675 repo.dirstate.write()
@@ -2043,7 +2043,7 b' def strip(ui, repo, rev, **opts):'
2043 elif opts['nobackup']:
2043 elif opts['nobackup']:
2044 backup = 'none'
2044 backup = 'none'
2045 update = repo.dirstate.parents()[0] != revlog.nullid
2045 update = repo.dirstate.parents()[0] != revlog.nullid
2046 repo.mq.strip(repo, rev, backup=backup, update=update)
2046 repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force'])
2047 return 0
2047 return 0
2048
2048
2049 def select(ui, repo, *args, **opts):
2049 def select(ui, repo, *args, **opts):
@@ -2352,7 +2352,8 b' cmdtable = {'
2352 _('hg qseries [-ms]')),
2352 _('hg qseries [-ms]')),
2353 "^strip":
2353 "^strip":
2354 (strip,
2354 (strip,
2355 [('b', 'backup', None, _('bundle unrelated changesets')),
2355 [('f', 'force', None, _('force removal with local changes')),
2356 ('b', 'backup', None, _('bundle unrelated changesets')),
2356 ('n', 'nobackup', None, _('no backups'))],
2357 ('n', 'nobackup', None, _('no backups'))],
2357 _('hg strip [-f] [-b] [-n] REV')),
2358 _('hg strip [-f] [-b] [-n] REV')),
2358 "qtop": (top, [] + seriesopts, _('hg qtop [-s]')),
2359 "qtop": (top, [] + seriesopts, _('hg qtop [-s]')),
@@ -266,6 +266,14 b' hg ci -Ama'
266 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
266 hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
267 hg unbundle .hg/strip-backup/*
267 hg unbundle .hg/strip-backup/*
268
268
269 echo % strip with local changes, should complain
270 hg up
271 echo y>y
272 hg add y
273 hg strip tip | sed 's/\(saving bundle to \).*/\1/'
274 echo % --force strip with local changes
275 hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/'
276
269 echo '% cd b; hg qrefresh'
277 echo '% cd b; hg qrefresh'
270 hg init refresh
278 hg init refresh
271 cd refresh
279 cd refresh
@@ -250,6 +250,12 b' adding manifests'
250 adding file changes
250 adding file changes
251 added 1 changesets with 1 changes to 1 files
251 added 1 changesets with 1 changes to 1 files
252 (run 'hg update' to get a working copy)
252 (run 'hg update' to get a working copy)
253 % strip with local changes, should complain
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 abort: local changes found
256 % --force strip with local changes
257 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
258 saving bundle to
253 % cd b; hg qrefresh
259 % cd b; hg qrefresh
254 adding a
260 adding a
255 foo
261 foo
General Comments 0
You need to be logged in to leave comments. Login now