# HG changeset patch # User Benoit Boissinot # Date 1304100166 -7200 # Node ID 865c30d54c30613ca4dc1519af9c48eee86fe3ed # Parent 1f667030b1396a1b7d5a7c5b5a11a1880be20860# Parent 78ab705a8147b776dc4a50a112d071878867b01b merge with crew diff -r 1f667030b139 -r 865c30d54c30 hgext/mq.py --- a/hgext/mq.py Fri Apr 29 09:28:45 2011 -0500 +++ b/hgext/mq.py Fri Apr 29 20:02:46 2011 +0200 @@ -2555,8 +2555,9 @@ """strip changesets and all their descendants from the repository The strip command removes the specified changesets and all their - descendants. If the working directory has uncommitted changes, - the operation is aborted unless the --force flag is supplied. + descendants. If the working directory has uncommitted changes, the + operation is aborted unless the --force flag is supplied, in which + case changes will be discarded. If a parent of the working directory is stripped, then the working directory will automatically be updated to the most recent @@ -3252,8 +3253,8 @@ _('hg qseries [-ms]')), "strip": (strip, - [('f', 'force', None, _('force removal of changesets even if the ' - 'working directory has uncommitted changes')), + [('f', 'force', None, _('force removal of changesets, discard ' + 'uncommitted changes (no backup)')), ('b', 'backup', None, _('bundle only changesets with local revision' ' number greater than REV which are not' ' descendants of REV (DEPRECATED)')), diff -r 1f667030b139 -r 865c30d54c30 mercurial/bookmarks.py --- a/mercurial/bookmarks.py Fri Apr 29 09:28:45 2011 -0500 +++ b/mercurial/bookmarks.py Fri Apr 29 20:02:46 2011 +0200 @@ -7,8 +7,8 @@ from mercurial.i18n import _ from mercurial.node import nullid, nullrev, bin, hex, short -from mercurial import encoding, util -import os +from mercurial import encoding, error, util +import errno, os def valid(mark): for c in (':', '\0', '\n', '\r'): @@ -23,14 +23,18 @@ in the .hg/bookmarks file. Read the file and return a (name=>nodeid) dictionary ''' + bookmarks = {} try: - bookmarks = {} for line in repo.opener('bookmarks'): sha, refspec = line.strip().split(' ', 1) refspec = encoding.tolocal(refspec) - bookmarks[refspec] = repo.changelog.lookup(sha) - except IOError: - pass + try: + bookmarks[refspec] = repo.changelog.lookup(sha) + except error.RepoLookupError: + pass + except IOError, inst: + if inst.errno != errno.ENOENT: + raise return bookmarks def readcurrent(repo): @@ -41,12 +45,18 @@ is stored in .hg/bookmarks.current ''' mark = None - if os.path.exists(repo.join('bookmarks.current')): + try: file = repo.opener('bookmarks.current') + except IOError, inst: + if inst.errno != errno.ENOENT: + raise + return None + try: # No readline() in posixfile_nt, reading everything is cheap mark = encoding.tolocal((file.readlines() or [''])[0]) if mark == '' or mark not in repo._bookmarks: mark = None + finally: file.close() return mark