Mercurial > hg
changeset 6472:8c4cd80afd3e
mq: add --force option to strip
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Fri, 04 Apr 2008 17:44:31 +0200 |
parents | 0c1ec0cd7c6a |
children | 93e4bb8ca275 e837dded56c7 |
files | hgext/mq.py tests/test-mq tests/test-mq.out |
diffstat | 3 files changed, 19 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Fri Apr 04 22:19:24 2008 +0200 +++ b/hgext/mq.py Fri Apr 04 17:44:31 2008 +0200 @@ -662,14 +662,14 @@ finally: del wlock - def strip(self, repo, rev, update=True, backup="all"): + def strip(self, repo, rev, update=True, backup="all", force=None): wlock = lock = None try: wlock = repo.wlock() lock = repo.lock() if update: - self.check_localchanges(repo, refresh=False) + self.check_localchanges(repo, force=force, refresh=False) urev = self.qparents(repo, rev) hg.clean(repo, urev) repo.dirstate.write() @@ -2043,7 +2043,7 @@ elif opts['nobackup']: backup = 'none' update = repo.dirstate.parents()[0] != revlog.nullid - repo.mq.strip(repo, rev, backup=backup, update=update) + repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force']) return 0 def select(ui, repo, *args, **opts): @@ -2352,7 +2352,8 @@ _('hg qseries [-ms]')), "^strip": (strip, - [('b', 'backup', None, _('bundle unrelated changesets')), + [('f', 'force', None, _('force removal with local changes')), + ('b', 'backup', None, _('bundle unrelated changesets')), ('n', 'nobackup', None, _('no backups'))], _('hg strip [-f] [-b] [-n] REV')), "qtop": (top, [] + seriesopts, _('hg qtop [-s]')),
--- a/tests/test-mq Fri Apr 04 22:19:24 2008 +0200 +++ b/tests/test-mq Fri Apr 04 17:44:31 2008 +0200 @@ -266,6 +266,14 @@ hg strip tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' hg unbundle .hg/strip-backup/* +echo % strip with local changes, should complain +hg up +echo y>y +hg add y +hg strip tip | sed 's/\(saving bundle to \).*/\1/' +echo % --force strip with local changes +hg strip -f tip 2>&1 | sed 's/\(saving bundle to \).*/\1/' + echo '% cd b; hg qrefresh' hg init refresh cd refresh
--- a/tests/test-mq.out Fri Apr 04 22:19:24 2008 +0200 +++ b/tests/test-mq.out Fri Apr 04 17:44:31 2008 +0200 @@ -250,6 +250,12 @@ adding file changes added 1 changesets with 1 changes to 1 files (run 'hg update' to get a working copy) +% strip with local changes, should complain +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +abort: local changes found +% --force strip with local changes +0 files updated, 0 files merged, 2 files removed, 0 files unresolved +saving bundle to % cd b; hg qrefresh adding a foo