changeset 9222:50cf61eb33e0

merge with stable
author Martin Geisler <mg@lazybytes.net>
date Thu, 16 Jul 2009 16:55:17 +0200
parents 7469a87dfbbf (current diff) 78e54b9f3a62 (diff)
children b60c4b6e69a1
files
diffstat 23 files changed, 125 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/doc/gendoc.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/doc/gendoc.py	Thu Jul 16 16:55:17 2009 +0200
@@ -103,7 +103,9 @@
         underlined(gettext(section).upper())
         if callable(doc):
             doc = doc()
-        ui.write(gettext(doc))
+        else:
+            doc = gettext(doc)
+        ui.write(doc)
         ui.write("\n")
 
 if __name__ == "__main__":
--- a/hgext/acl.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/hgext/acl.py	Thu Jul 16 16:55:17 2009 +0200
@@ -84,7 +84,7 @@
     if source == 'serve' and 'url' in kwargs:
         url = kwargs['url'].split(':')
         if url[0] == 'remote' and url[1].startswith('http'):
-            user = urllib.unquote(url[2])
+            user = urllib.unquote(url[3])
 
     if user is None:
         user = getpass.getuser()
--- a/hgext/convert/cvs.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/hgext/convert/cvs.py	Thu Jul 16 16:55:17 2009 +0200
@@ -282,7 +282,9 @@
         self.writep.flush()
         r = self.readp.readline()
         if not r.startswith("Valid-requests"):
-            raise util.Abort(_("server sucks"))
+            raise util.Abort(_("unexpected response from CVS server "
+                               "(expected \"Valid-requests\", but got %r)")
+                             % r)
         if "UseUnchanged" in r:
             self.writep.write("UseUnchanged\n")
             self.writep.flush()
--- a/hgext/keyword.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/hgext/keyword.py	Thu Jul 16 16:55:17 2009 +0200
@@ -459,13 +459,14 @@
             data = super(kwrepo, self).wread(filename)
             return kwt.wread(filename, data)
 
-        def commit(self, text='', user=None, date=None, match=None,
-                   force=False, editor=None, extra={}):
+        def commit(self, *args, **opts):
             # use custom commitctx for user commands
             # other extensions can still wrap repo.commitctx directly
-            repo.commitctx = self.kwcommitctx
-            return super(kwrepo, self).commit(text, user, date, match, force,
-                         editor, extra)
+            self.commitctx = self.kwcommitctx
+            try:
+                return super(kwrepo, self).commit(*args, **opts)
+            finally:
+                del self.commitctx
 
         def kwcommitctx(self, ctx, error=False):
             wlock = lock = None
@@ -489,7 +490,7 @@
                 if commithooks:
                     for name, cmd in commithooks.iteritems():
                         ui.setconfig('hooks', name, cmd)
-                    repo.hook('commit', node=n, parent1=xp1, parent2=xp2)
+                    self.hook('commit', node=n, parent1=xp1, parent2=xp2)
                 return n
             finally:
                 release(lock, wlock)
--- a/hgext/win32mbcs.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/hgext/win32mbcs.py	Thu Jul 16 16:55:17 2009 +0200
@@ -38,7 +38,7 @@
 setting or HGENCODING.
 '''
 
-import os
+import os, sys
 from mercurial.i18n import _
 from mercurial import util, encoding
 
@@ -79,10 +79,8 @@
                          " %s encoding\n") % (encoding.encoding))
 
 def wrapname(name):
-    idx = name.rfind('.')
-    module = name[:idx]
-    name = name[idx+1:]
-    module = globals()[module]
+    module, name = name.rsplit('.', 1)
+    module = sys.modules[module]
     func = getattr(module, name)
     def f(*args):
         return wrapper(func, args)
@@ -97,7 +95,8 @@
 #       they use result of os.path.split()
 funcs = '''os.path.join os.path.split os.path.splitext
  os.path.splitunc os.path.normpath os.path.normcase os.makedirs
- util.endswithsep util.splitpath util.checkcase util.fspath'''
+ mercurial.util.endswithsep mercurial.util.splitpath mercurial.util.checkcase
+ mercurial.util.fspath mercurial.windows.pconvert'''
 
 # codec and alias names of sjis and big5 to be faked.
 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
--- a/mercurial/cmdutil.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/cmdutil.py	Thu Jul 16 16:55:17 2009 +0200
@@ -242,7 +242,10 @@
     for p in pats:
         kind, name = _match._patsplit(p, None)
         if kind is None:
-            globbed = glob.glob(name)
+            try:
+                globbed = glob.glob(name)
+            except re.error:
+                globbed = [name]
             if globbed:
                 ret.extend(globbed)
                 continue
--- a/mercurial/commands.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/commands.py	Thu Jul 16 16:55:17 2009 +0200
@@ -1206,18 +1206,7 @@
     if opts.get('print0'):
         sep = eol = '\0'
 
-    fcache = {}
-    forder = []
-    def getfile(fn):
-        if fn not in fcache:
-            if len(fcache) > 20:
-                del fcache[forder.pop(0)]
-            fcache[fn] = repo.file(fn)
-        else:
-            forder.remove(fn)
-
-        forder.append(fn)
-        return fcache[fn]
+    getfile = util.lrucachefunc(repo.file)
 
     def matchlines(body):
         begin = 0
--- a/mercurial/context.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/context.py	Thu Jul 16 16:55:17 2009 +0200
@@ -291,6 +291,7 @@
 
     def linkrev(self): return self._filelog.linkrev(self._filerev)
     def node(self): return self._changectx.node()
+    def hex(self): return hex(self.node())
     def user(self): return self._changectx.user()
     def date(self): return self._changectx.date()
     def files(self): return self._changectx.files()
@@ -379,11 +380,11 @@
                 child[0][b1:b2] = parent[0][a1:a2]
             return child
 
-        getlog = util.cachefunc(lambda x: self._repo.file(x))
+        getlog = util.lrucachefunc(lambda x: self._repo.file(x))
         def getctx(path, fileid):
             log = path == self._path and self._filelog or getlog(path)
             return filectx(self._repo, path, fileid=fileid, filelog=log)
-        getctx = util.cachefunc(getctx)
+        getctx = util.lrucachefunc(getctx)
 
         def parents(f):
             # we want to reuse filectx objects as much as possible
--- a/mercurial/copies.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/copies.py	Thu Jul 16 16:55:17 2009 +0200
@@ -120,8 +120,8 @@
                 return c1.filectx(f)
             return c2.filectx(f)
         return repo.filectx(f, fileid=n)
-    ctx = util.cachefunc(makectx)
 
+    ctx = util.lrucachefunc(makectx)
     copy = {}
     fullcopy = {}
     diverge = {}
--- a/mercurial/help.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/help.py	Thu Jul 16 16:55:17 2009 +0200
@@ -449,17 +449,19 @@
      _(r'''
     Valid URLs are of the form:
 
-      local/filesystem/path (or file://local/filesystem/path)
-      http://[user[:pass]@]host[:port]/[path]
-      https://[user[:pass]@]host[:port]/[path]
-      ssh://[user[:pass]@]host[:port]/[path]
+      local/filesystem/path[#revision]
+      file://local/filesystem/path[#revision]
+      http://[user[:pass]@]host[:port]/[path][#revision]
+      https://[user[:pass]@]host[:port]/[path][#revision]
+      ssh://[user[:pass]@]host[:port]/[path][#revision]
 
     Paths in the local filesystem can either point to Mercurial
     repositories or to bundle files (as created by 'hg bundle' or
     'hg incoming --bundle').
 
     An optional identifier after # indicates a particular branch, tag,
-    or changeset to use from the remote repository.
+    or changeset to use from the remote repository. See also 'hg help
+    revisions'.
 
     Some features, such as pushing to http:// and https:// URLs are
     only possible if the feature is explicitly enabled on the remote
--- a/mercurial/localrepo.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/localrepo.py	Thu Jul 16 16:55:17 2009 +0200
@@ -473,7 +473,9 @@
                 latest = newnodes.pop()
                 if latest not in bheads:
                     continue
-                reachable = self.changelog.reachable(latest, bheads[0])
+                reachable = set()
+                for bh in bheads:
+                    reachable |= self.changelog.reachable(latest, bh)
                 bheads = [b for b in bheads if b not in reachable]
                 newbheads.insert(0, latest)
             bheads.extend(newbheads)
--- a/mercurial/transaction.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/transaction.py	Thu Jul 16 16:55:17 2009 +0200
@@ -35,7 +35,7 @@
             try:
                 fn = opener(f).name
                 os.unlink(fn)
-            except OSError, inst:
+            except IOError, inst:
                 if inst.errno != errno.ENOENT:
                     raise
     os.unlink(journal)
--- a/mercurial/url.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/url.py	Thu Jul 16 16:55:17 2009 +0200
@@ -441,6 +441,7 @@
             # let host port take precedence
             if ':' in host and '[' not in host or ']:' in host:
                 host, port = host.rsplit(':', 1)
+                port = int(port)
                 if '[' in host:
                     host = host[1:-1]
 
--- a/mercurial/util.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/util.py	Thu Jul 16 16:55:17 2009 +0200
@@ -39,11 +39,16 @@
 import subprocess
 closefds = os.name == 'posix'
 def popen2(cmd):
-    p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
+    # Setting bufsize to -1 lets the system decide the buffer size.
+    # The default for bufsize is 0, meaning unbuffered. This leads to
+    # poor performance on Mac OS X: http://bugs.python.org/issue4194
+    p = subprocess.Popen(cmd, shell=True, bufsize=-1,
+                         close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE)
     return p.stdin, p.stdout
 def popen3(cmd):
-    p = subprocess.Popen(cmd, shell=True, close_fds=closefds,
+    p = subprocess.Popen(cmd, shell=True, bufsize=-1,
+                         close_fds=closefds,
                          stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                          stderr=subprocess.PIPE)
     return p.stdin, p.stdout, p.stderr
@@ -110,6 +115,33 @@
 
     return f
 
+def lrucachefunc(func):
+    '''cache most recent results of function calls'''
+    cache = {}
+    order = []
+    if func.func_code.co_argcount == 1:
+        def f(arg):
+            if arg not in cache:
+                if len(cache) > 20:
+                    del cache[order.pop(0)]
+                cache[arg] = func(arg)
+            else:
+                order.remove(arg)
+            order.append(arg)
+            return cache[arg]
+    else:
+        def f(*args):
+            if args not in cache:
+                if len(cache) > 20:
+                    del cache[order.pop(0)]
+                cache[args] = func(*args)
+            else:
+                order.remove(args)
+            order.append(args)
+            return cache[args]
+
+    return f
+
 class propertycache(object):
     def __init__(self, func):
         self.func = func
--- a/mercurial/windows.py	Mon Jul 06 10:39:46 2009 -0300
+++ b/mercurial/windows.py	Thu Jul 16 16:55:17 2009 +0200
@@ -209,11 +209,9 @@
     dircache = {} # dirname -> filename -> status | None if file does not exist
     for nf in files:
         nf  = ncase(nf)
-        pos = nf.rfind(sep)
-        if pos == -1:
-            dir, base = '.', nf
-        else:
-            dir, base = nf[:pos+1], nf[pos+1:]
+        dir, base = os.path.split(nf)
+        if not dir:
+            dir = '.'
         cache = dircache.get(dir, None)
         if cache is None:
             try:
--- a/templates/gitweb/map	Mon Jul 06 10:39:46 2009 -0300
+++ b/templates/gitweb/map	Thu Jul 16 16:55:17 2009 +0200
@@ -72,9 +72,7 @@
 filelog = filelog.tmpl
 fileline = '
   <div style="font-family:monospace" class="parity{parity}">
-    <pre>
-      <a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}
-    </pre>
+    <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre>
   </div>'
 annotateline = '
   <tr style="font-family:monospace" class="parity{parity}">
--- a/templates/monoblue/map	Mon Jul 06 10:39:46 2009 -0300
+++ b/templates/monoblue/map	Thu Jul 16 16:55:17 2009 +0200
@@ -63,9 +63,7 @@
 filelog = filelog.tmpl
 fileline = '
   <div style="font-family:monospace" class="parity{parity}">
-    <pre>
-      <a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}
-    </pre>
+    <pre><a class="linenr" href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</pre>
   </div>'
 annotateline = '
   <tr class="parity{parity}">
--- a/tests/bzr-definitions	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/bzr-definitions	Thu Jul 16 16:55:17 2009 +0200
@@ -2,7 +2,7 @@
 
 "$TESTDIR/hghave" bzr || exit 80
 
-export TERM=dumb
+TERM=dumb; export TERM
 echo '[extensions]' >> $HGRCPATH
 echo 'convert = ' >> $HGRCPATH
 echo 'hgext.graphlog = ' >> $HGRCPATH
--- a/tests/test-convert-p4	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/test-convert-p4	Thu Jul 16 16:55:17 2009 +0200
@@ -6,12 +6,12 @@
 echo "convert = " >> $HGRCPATH
 
 echo % create p4 depot
-export P4ROOT=$PWD/depot
-export P4AUDIT=$P4ROOT/audit
-export P4JOURNAL=$P4ROOT/journal
-export P4LOG=$P4ROOT/log
-export P4PORT=localhost:16661
-export P4DEBUG=1
+P4ROOT=`pwd`/depot; export P4ROOT
+P4AUDIT=$P4ROOT/audit; export P4AUDIT
+P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
+P4LOG=$P4ROOT/log; export P4LOG
+P4PORT=localhost:16661; export P4PORT
+P4DEBUG=1; export P4DEBUG
 
 echo % start the p4 server
 [ ! -d $P4ROOT ] && mkdir $P4ROOT
@@ -24,7 +24,7 @@
 done >/dev/null 2>/dev/null
 
 echo % create a client spec
-export P4CLIENT=hg-p4-import
+P4CLIENT=hg-p4-import; export P4CLIENT
 DEPOTPATH=//depot/test-mercurial-import/...
 p4 client -o | sed '/^View:/,$ d' >p4client
 echo View: >>p4client
--- a/tests/test-convert-p4-filetypes	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/test-convert-p4-filetypes	Thu Jul 16 16:55:17 2009 +0200
@@ -6,13 +6,13 @@
 echo "convert = " >> $HGRCPATH
 
 echo % create p4 depot
-export P4ROOT=$PWD/depot
-export P4AUDIT=$P4ROOT/audit
-export P4JOURNAL=$P4ROOT/journal
-export P4LOG=$P4ROOT/log
-export P4PORT=localhost:16661
-export P4DEBUG=1
-export P4CHARSET=utf8
+P4ROOT=$PWD/depot; export P4ROOT
+P4AUDIT=$P4ROOT/audit; export P4AUDIT
+P4JOURNAL=$P4ROOT/journal; export P4JOURNAL
+P4LOG=$P4ROOT/log; export P4LOG
+P4PORT=localhost:16661; export P4PORT
+P4DEBUG=1; export P4DEBUG
+P4CHARSET=utf8; export P4CHARSET
 
 echo % start the p4 server
 [ ! -d $P4ROOT ] && mkdir $P4ROOT
@@ -26,7 +26,7 @@
 done >/dev/null 2>/dev/null
 
 echo % create a client spec
-export P4CLIENT=hg-p4-import
+P4CLIENT=hg-p4-import; export P4CLIENT
 DEPOTPATH=//depot/test-mercurial-import/...
 p4 client -o | sed '/^View:/,$ d' >p4client
 echo View: >>p4client
--- a/tests/test-fetch	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/test-fetch	Thu Jul 16 16:55:17 2009 +0200
@@ -185,6 +185,18 @@
 hg --cwd ib2 fetch ../ib1
 rm -fr ib1 ib2
 
+echo % test issue1726
+hg init i1726r1
+echo a > i1726r1/a
+hg --cwd i1726r1 ci -Am base
+hg clone i1726r1 i1726r2
+echo b > i1726r1/a
+hg --cwd i1726r1 ci -m second
+echo c > i1726r2/a
+hg --cwd i1726r2 ci -m third
+HGMERGE=true hg --cwd i1726r2 fetch ../i1726r1 | sed 's/new changeset 3:[0-9a-zA-Z]\+/new changeset 3/'
+hg --cwd i1726r2 heads default --template '{rev}\n'
+
 "$TESTDIR/killdaemons.py"
 
 true
--- a/tests/test-fetch.out	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/test-fetch.out	Thu Jul 16 16:55:17 2009 +0200
@@ -190,3 +190,20 @@
 pulling from ../ib1
 searching for changes
 no changes found
+% test issue1726
+adding a
+updating working directory
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+pulling from ../i1726r1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+updating to 2:7837755a2789
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+merging with 1:d1f0c6c48ebd
+merging a
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+new changeset 3 merges remote changes with local
+3
--- a/tests/test-template-engine	Mon Jul 06 10:39:46 2009 -0300
+++ b/tests/test-template-engine	Thu Jul 16 16:55:17 2009 +0200
@@ -20,7 +20,7 @@
 
 hg init test
 echo '[extensions]' > test/.hg/hgrc
-echo "engine = $PWD/engine.py" >> test/.hg/hgrc
+echo "engine = `pwd`/engine.py" >> test/.hg/hgrc
 
 cd test
 cat > mymap << EOF