changeset 14035:865c30d54c30

merge with crew
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 29 Apr 2011 20:02:46 +0200
parents 1f667030b139 (current diff) 78ab705a8147 (diff)
children 90d997a812dc
files
diffstat 2 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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)')),
--- 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