changeset 9505:28b089ae4001

Merge with i18n-stable
author Matt Mackall <mpm@selenic.com>
date Wed, 30 Sep 2009 13:15:18 -0500
parents b2d65ee49a72 (diff) a1ee850f49e3 (current diff)
children 49b62395e910 449e85edc8f1
files
diffstat 11 files changed, 80 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/p4.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/hgext/convert/p4.py	Wed Sep 30 13:15:18 2009 -0500
@@ -53,7 +53,7 @@
     def _parse_view(self, path):
         "Read changes affecting the path"
         cmd = 'p4 -G changes -s submitted "%s"' % path
-        stdout = util.popen(cmd)
+        stdout = util.popen(cmd, mode='rb')
         for d in loaditer(stdout):
             c = d.get("change", None)
             if c:
@@ -72,7 +72,7 @@
                 views = {"//": ""}
         else:
             cmd = 'p4 -G client -o "%s"' % path
-            clientspec = marshal.load(util.popen(cmd))
+            clientspec = marshal.load(util.popen(cmd, mode='rb'))
 
             views = {}
             for client in clientspec:
@@ -105,7 +105,7 @@
         lastid = None
         for change in self.p4changes:
             cmd = "p4 -G describe %s" % change
-            stdout = util.popen(cmd)
+            stdout = util.popen(cmd, mode='rb')
             d = marshal.load(stdout)
 
             desc = self.recode(d["desc"])
@@ -147,7 +147,7 @@
 
     def getfile(self, name, rev):
         cmd = 'p4 -G print "%s#%s"' % (self.depotname[name], rev)
-        stdout = util.popen(cmd)
+        stdout = util.popen(cmd, mode='rb')
 
         mode = None
         contents = ""
--- a/hgext/win32mbcs.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/hgext/win32mbcs.py	Wed Sep 30 13:15:18 2009 -0500
@@ -120,7 +120,7 @@
 funcs = '''os.path.join os.path.split os.path.splitext
  os.path.splitunc os.path.normpath os.path.normcase os.makedirs
  mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase
- mercurial.util.fspath mercurial.util.pconvert'''
+ mercurial.util.fspath mercurial.util.pconvert mercurial.util.normpath'''
 
 # codec and alias names of sjis and big5 to be faked.
 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
--- a/mercurial/config.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/mercurial/config.py	Wed Sep 30 13:15:18 2009 -0500
@@ -93,6 +93,7 @@
                     self.set(section, item, v, "%s:%d" % (src, line))
                     continue
                 item = None
+                cont = False
             m = includere.match(l)
             if m:
                 inc = m.group(1)
--- a/mercurial/dispatch.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/mercurial/dispatch.py	Wed Sep 30 13:15:18 2009 -0500
@@ -24,6 +24,9 @@
     except util.Abort, inst:
         sys.stderr.write(_("abort: %s\n") % inst)
         return -1
+    except error.ConfigError, inst:
+        sys.stderr.write(_("hg: %s\n") % inst)
+        return -1
     return _runcatch(u, args)
 
 def _runcatch(ui, args):
--- a/mercurial/localrepo.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/mercurial/localrepo.py	Wed Sep 30 13:15:18 2009 -0500
@@ -1183,17 +1183,24 @@
         return [n for (r, n) in sorted(heads)]
 
     def branchheads(self, branch=None, start=None, closed=False):
+        '''return a (possibly filtered) list of heads for the given branch
+
+        Heads are returned in topological order, from newest to oldest.
+        If branch is None, use the dirstate branch.
+        If start is not None, return only heads reachable from start.
+        If closed is True, return heads that are marked as closed as well.
+        '''
         if branch is None:
             branch = self[None].branch()
         branches = self.branchmap()
         if branch not in branches:
             return []
-        bheads = branches[branch]
         # the cache returns heads ordered lowest to highest
-        bheads.reverse()
+        bheads = list(reversed(branches[branch]))
         if start is not None:
             # filter out the heads that cannot be reached from startrev
-            bheads = self.changelog.nodesbetween([start], bheads)[2]
+            fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
+            bheads = [h for h in bheads if h in fbheads]
         if not closed:
             bheads = [h for h in bheads if
                       ('close' not in self.changelog.read(h)[5])]
@@ -1486,19 +1493,16 @@
         inc = self.findincoming(remote, common, remote_heads, force=force)
 
         update, updated_heads = self.findoutgoing(remote, common, remote_heads)
-        if revs is not None:
-            msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
-        else:
-            bases, heads = update, self.changelog.heads()
+        msng_cl, bases, heads = self.changelog.nodesbetween(update, revs)
 
-        def checkbranch(lheads, rheads, updatelh):
+        def checkbranch(lheads, rheads, updatelb):
             '''
             check whether there are more local heads than remote heads on
             a specific branch.
 
             lheads: local branch heads
             rheads: remote branch heads
-            updatelh: outgoing local branch heads
+            updatelb: outgoing local branch bases
             '''
 
             warn = 0
@@ -1506,13 +1510,15 @@
             if not revs and len(lheads) > len(rheads):
                 warn = 1
             else:
+                # add local heads involved in the push
                 updatelheads = [self.changelog.heads(x, lheads)
-                                for x in updatelh]
+                                for x in updatelb]
                 newheads = set(sum(updatelheads, [])) & set(lheads)
 
                 if not newheads:
                     return True
 
+                # add heads we don't have or that are not involved in the push
                 for r in rheads:
                     if r in self.changelog.nodemap:
                         desc = self.changelog.heads(r, heads)
@@ -1528,7 +1534,7 @@
                 if not rheads: # new branch requires --force
                     self.ui.warn(_("abort: push creates new"
                                    " remote branch '%s'!\n") %
-                                   self[updatelh[0]].branch())
+                                   self[updatelb[0]].branch())
                 else:
                     self.ui.warn(_("abort: push creates new remote heads!\n"))
 
@@ -1571,11 +1577,11 @@
                         else:
                             rheads = []
                         lheads = localhds[lh]
-                        updatelh = [upd for upd in update
+                        updatelb = [upd for upd in update
                                     if self[upd].branch() == lh]
-                        if not updatelh:
+                        if not updatelb:
                             continue
-                        if not checkbranch(lheads, rheads, updatelh):
+                        if not checkbranch(lheads, rheads, updatelb):
                             return None, 0
                 else:
                     if not checkbranch(heads, remote_heads, update):
--- a/mercurial/util.py	Tue Sep 29 00:42:14 2009 +0200
+++ b/mercurial/util.py	Wed Sep 30 13:15:18 2009 -0500
@@ -14,7 +14,7 @@
 """
 
 from i18n import _
-import error, osutil
+import error, osutil, encoding
 import cStringIO, errno, re, shutil, sys, tempfile, traceback
 import os, stat, time, calendar, random, textwrap
 import imp
@@ -1276,7 +1276,14 @@
 
 def wrap(line, hangindent, width=78):
     padding = '\n' + ' ' * hangindent
-    return padding.join(textwrap.wrap(line, width=width - hangindent))
+    # To avoid corrupting multi-byte characters in line, we must wrap
+    # a Unicode string instead of a bytestring.
+    try:
+        u = line.decode(encoding.encoding)
+        w = padding.join(textwrap.wrap(u, width=width - hangindent))
+        return w.encode(encoding.encoding)
+    except UnicodeDecodeError:
+        return padding.join(textwrap.wrap(line, width=width - hangindent))
 
 def iterlines(iterator):
     for chunk in iterator:
--- a/tests/test-bheads.out	Tue Sep 29 00:42:14 2009 +0200
+++ b/tests/test-bheads.out	Wed Sep 30 13:15:18 2009 -0500
@@ -68,8 +68,8 @@
 3: Adding b branch head 1
 0
 -------
+6: Merging b branch head 2 and b branch head 3
 3: Adding b branch head 1
-6: Merging b branch head 2 and b branch head 3
 0
 -------
 no changes on branch b containing . are reachable from 7
--- a/tests/test-hgrc	Tue Sep 29 00:42:14 2009 +0200
+++ b/tests/test-hgrc	Wed Sep 30 13:15:18 2009 -0500
@@ -16,3 +16,9 @@
 cat .hg/hgrc |sed -e "s:$p:...:"
 hg paths |sed -e "s:$p:...:"
 hg showconfig |sed -e "s:$p:...:"
+
+# issue1829: wrong indentation
+cd ..
+echo '[foo]' >> $HGRCPATH
+echo '  x = y' >> $HGRCPATH
+hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
--- a/tests/test-hgrc.out	Tue Sep 29 00:42:14 2009 +0200
+++ b/tests/test-hgrc.out	Wed Sep 30 13:15:18 2009 -0500
@@ -10,3 +10,4 @@
 defaults.tag=-d "0 0"
 paths.default=.../foo%bar
 ui.slash=True
+hg: config error at $HGRCPATH:8: '  x = y'
--- a/tests/test-push-warn	Tue Sep 29 00:42:14 2009 +0200
+++ b/tests/test-push-warn	Wed Sep 30 13:15:18 2009 -0500
@@ -123,4 +123,21 @@
 hg -q ci -d "1000000 0" -m 11
 hg push -r 10 -r 11 ../f; echo $?
 
+echo % checking prepush logic does not allow silently pushing multiple new heads
+cd ..
+hg init g
+echo init > g/init
+hg -R g ci -Am init
+echo a > g/a
+hg -R g ci -Am a
+hg clone g h
+hg -R g up 0
+echo b > g/b
+hg -R g ci -Am b
+hg -R h up 0
+echo c > h/c
+hg -R h ci -Am c
+hg -R h push g
+echo
+
 exit 0
--- a/tests/test-push-warn.out	Tue Sep 29 00:42:14 2009 +0200
+++ b/tests/test-push-warn.out	Wed Sep 30 13:15:18 2009 -0500
@@ -124,3 +124,20 @@
 adding file changes
 added 2 changesets with 2 changes to 1 files
 0
+% checking prepush logic does not allow silently pushing multiple new heads
+abort: repository g already exists!
+adding init
+adding a
+updating working directory
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+adding b
+created new head
+1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+adding c
+created new head
+pushing to g
+searching for changes
+abort: push creates new remote heads!
+(did you forget to merge? use push -f to force)
+