diff -r 635541b970e5 -r 8c01ce1f2530 hgext/mq.py --- a/hgext/mq.py Mon Jun 02 21:42:16 2008 +0200 +++ b/hgext/mq.py Tue Jun 03 12:27:48 2008 +0200 @@ -1532,6 +1532,10 @@ def qimport(ui, repo, *filename, **opts): """import a patch + The patch is inserted into the series after the last applied patch. + If no patches have been applied, qimport prepends the patch + to the series. + The patch will have the same name as its source file unless you give it a new one with --name. @@ -2054,14 +2058,28 @@ return 0 def strip(ui, repo, rev, **opts): - """strip a revision and all later revs on the same branch""" - rev = repo.lookup(rev) + """strip a revision and all its descendants from the repository + + If one of the working dir's parent revisions is stripped, the working + directory will be updated to the parent of the stripped revision. + """ backup = 'all' if opts['backup']: backup = 'strip' elif opts['nobackup']: backup = 'none' - update = repo.dirstate.parents()[0] != revlog.nullid + + rev = repo.lookup(rev) + p = repo.dirstate.parents() + cl = repo.changelog + update = True + if p[0] == revlog.nullid: + update = False + elif p[1] == revlog.nullid and rev != cl.ancestor(p[0], rev): + update = False + elif rev not in (cl.ancestor(p[0], rev), cl.ancestor(p[1], rev)): + update = False + repo.mq.strip(repo, rev, backup=backup, update=update, force=opts['force']) return 0