changeset 13312:9f188734dbb0 stable

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Jan 2011 17:21:23 -0600
parents 7f2b8aac7bdc (diff) 9b678a2c0400 (current diff)
children 0c493e5ce8e9 8dc488dfcdb4 11cc2b863866
files
diffstat 6 files changed, 62 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/bookmarks.py	Mon Jan 24 11:27:56 2011 +0100
+++ b/hgext/bookmarks.py	Thu Jan 27 17:21:23 2011 -0600
@@ -48,9 +48,8 @@
     try:
         bms = repo.opener('bookmarks').read()
     except IOError:
-        bms = None
-    if bms is not None:
-        repo.opener('undo.bookmarks', 'w').write(bms)
+        bms = ''
+    repo.opener('undo.bookmarks', 'w').write(bms)
 
     if repo._bookmarkcurrent not in refs:
         setcurrent(repo, None)
@@ -262,10 +261,14 @@
                 file.close()
             return mark
 
-        def rollback(self, *args):
+        def rollback(self, dryrun=False):
             if os.path.exists(self.join('undo.bookmarks')):
-                util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
-            return super(bookmark_repo, self).rollback(*args)
+                if not dryrun:
+                    util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
+                elif not os.path.exists(self.sjoin("undo")):
+                    # avoid "no rollback information available" message
+                    return 0
+            return super(bookmark_repo, self).rollback(dryrun)
 
         def lookup(self, key):
             if key in self._bookmarks:
--- a/mercurial/subrepo.py	Mon Jan 24 11:27:56 2011 +0100
+++ b/mercurial/subrepo.py	Thu Jan 27 17:21:23 2011 -0600
@@ -499,13 +499,23 @@
             raise util.Abort(stderr)
         return stdout
 
-    def _wcrev(self):
+    def _wcrevs(self):
+        # Get the working directory revision as well as the last
+        # commit revision so we can compare the subrepo state with
+        # both. We used to store the working directory one.
         output = self._svncommand(['info', '--xml'])
         doc = xml.dom.minidom.parseString(output)
         entries = doc.getElementsByTagName('entry')
-        if not entries:
-            return '0'
-        return str(entries[0].getAttribute('revision')) or '0'
+        lastrev, rev = '0', '0'
+        if entries:
+            rev = str(entries[0].getAttribute('revision')) or '0'
+            commits = entries[0].getElementsByTagName('commit')
+            if commits:
+                lastrev = str(commits[0].getAttribute('revision')) or '0'
+        return (lastrev, rev)
+
+    def _wcrev(self):
+        return self._wcrevs()[0]
 
     def _wcchanged(self):
         """Return (changes, extchanges) where changes is True
@@ -534,7 +544,7 @@
         return bool(changes), False
 
     def dirty(self):
-        if self._wcrev() == self._state[1] and not self._wcchanged()[0]:
+        if self._state[1] in self._wcrevs() and not self._wcchanged()[0]:
             return False
         return True
 
--- a/mercurial/util.py	Mon Jan 24 11:27:56 2011 +0100
+++ b/mercurial/util.py	Thu Jan 27 17:21:23 2011 -0600
@@ -913,6 +913,8 @@
                     # shares if the file is open.
                     fd = open(f)
                     nlink = nlinks(f)
+                    if nlink < 1:
+                        nlink = 2 # force mktempcopy (issue1922)
                     fd.close()
             except (OSError, IOError):
                 nlink = 0
--- a/mercurial/win32.py	Mon Jan 24 11:27:56 2011 +0100
+++ b/mercurial/win32.py	Thu Jan 27 17:21:23 2011 -0600
@@ -170,6 +170,8 @@
     try:
         # Query stderr to avoid problems with redirections
         screenbuf = win32console.GetStdHandle(win32console.STD_ERROR_HANDLE)
+        if screenbuf is None:
+            return 79
         try:
             window = screenbuf.GetConsoleScreenBufferInfo()['Window']
             width = window.Right - window.Left
--- a/tests/test-bookmarks-strip.t	Mon Jan 24 11:27:56 2011 +0100
+++ b/tests/test-bookmarks-strip.t	Thu Jan 27 17:21:23 2011 -0600
@@ -6,6 +6,12 @@
 
   $ echo qqq>qqq.txt
 
+rollback dry run without rollback information
+
+  $ hg rollback
+  no rollback information available
+  [1]
+
 add file
 
   $ hg add
@@ -83,5 +89,12 @@
   $ hg bookmarks markb
   $ hg bookmarks
    * markb                     0:07f494440405
+
+rollback dry run with rollback information
+
+  $ hg rollback -n
+  $ hg bookmarks
+   * markb                     0:07f494440405
+
   $ cd ..
 
--- a/tests/test-subrepo-svn.t	Mon Jan 24 11:27:56 2011 +0100
+++ b/tests/test-subrepo-svn.t	Thu Jan 27 17:21:23 2011 -0600
@@ -123,6 +123,25 @@
    source   file://*/svn-repo/src (glob)
    revision 2
 
+add an unrelated revision in svn and update the subrepo to without
+bringing any changes.
+
+  $ svn mkdir --parents "$SVNREPO/unrelated" -m 'create unrelated'
+  
+  Committed revision 4.
+  $ svn up s
+  
+  Fetching external item into 's/externals'
+  External at revision 1.
+  
+  At revision 4.
+  $ hg sum
+  parent: 2:* tip (glob)
+   Message!
+  branch: default
+  commit: (clean)
+  update: (current)
+
   $ echo a > s/a
 
 should be empty despite change to s/a
@@ -139,14 +158,14 @@
   A    externals/other
   Updated external to revision 1.
   
-  Updated to revision 3.
+  Updated to revision 4.
   $ echo xyz >> alpha
   $ svn propset svn:mime-type 'text/xml' alpha
   property 'svn:mime-type' set on 'alpha'
   $ svn ci -m 'amend a from svn'
   Sending        src/alpha
   Transmitting file data .
-  Committed revision 4.
+  Committed revision 5.
   $ cd ../../sub/t
 
 this commit from hg will fail