changeset 14877:29d324c2bc93 stable

merge with i18n
author Matt Mackall <mpm@selenic.com>
date Wed, 13 Jul 2011 19:30:09 -0500
parents f73c7b70df68 (diff) cf85003ef918 (current diff)
children ddc4567a3d0b 5233df79deed
files
diffstat 17 files changed, 106 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/eol.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/hgext/eol.py	Wed Jul 13 19:30:09 2011 -0500
@@ -318,7 +318,10 @@
             for f in sorted(ctx.added() + ctx.modified()):
                 if not self._eolfile(f):
                     continue
-                data = ctx[f].data()
+                try:
+                    data = ctx[f].data()
+                except IOError:
+                    continue
                 if util.binary(data):
                     # We should not abort here, since the user should
                     # be able to say "** = native" to automatically
--- a/hgext/hgcia.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/hgext/hgcia.py	Wed Jul 13 19:30:09 2011 -0500
@@ -81,6 +81,8 @@
         n = self.ctx.node()
         f = self.cia.repo.status(self.ctx.p1().node(), n)
         url = self.url or ''
+        if url and url[-1] == '/':
+            url = url[:-1]
         elems = []
         for path in f[0]:
             uri = '%s/diff/%s/%s' % (url, short(n), path)
@@ -141,8 +143,10 @@
         rev = '%d:%s' % (self.ctx.rev(), n)
         log = saxutils.escape(self.logmsg())
 
-        url = self.url and '<url>%s/rev/%s</url>' % (saxutils.escape(self.url),
-                                                     n) or ''
+        url = self.url
+        if url and url[-1] == '/':
+            url = url[:-1]
+        url = url and '<url>%s/rev/%s</url>' % (saxutils.escape(url), n) or ''
 
         msg = """
 <message>
@@ -190,7 +194,8 @@
         self.emailfrom = self.ui.config('email', 'from')
         self.dryrun = self.ui.configbool('cia', 'test')
         self.url = self.ui.config('web', 'baseurl')
-        self.stripcount = int(self.ui.config('cia', 'strip', 0))
+        # Default to -1 for backward compatibility
+        self.stripcount = int(self.ui.config('cia', 'strip', -1))
         self.root = self.strip(self.repo.root)
 
         style = self.ui.config('cia', 'style')
@@ -208,6 +213,8 @@
 
         path = util.pconvert(path)
         count = self.stripcount
+        if count < 0:
+            return ''
         while count > 0:
             c = path.find('/')
             if c == -1:
--- a/hgext/win32mbcs.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/hgext/win32mbcs.py	Wed Jul 13 19:30:09 2011 -0500
@@ -129,7 +129,8 @@
 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.normpath'''
+ mercurial.util.fspath mercurial.util.pconvert mercurial.util.normpath
+ mercurial.util.checkwinfilename mercurial.util.checkosfilename'''
 
 # codec and alias names of sjis and big5 to be faked.
 problematic_encodings = '''big5 big5-tw csbig5 big5hkscs big5-hkscs
--- a/mercurial/commands.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/commands.py	Wed Jul 13 19:30:09 2011 -0500
@@ -31,7 +31,7 @@
     ('', 'cwd', '',
      _('change working directory'), _('DIR')),
     ('y', 'noninteractive', None,
-     _('do not prompt, assume \'yes\' for any required answers')),
+     _('do not prompt, automatically pick the first choice for all prompts')),
     ('q', 'quiet', None, _('suppress output')),
     ('v', 'verbose', None, _('enable additional output')),
     ('', 'config', [],
--- a/mercurial/commandserver.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/commandserver.py	Wed Jul 13 19:30:09 2011 -0500
@@ -7,7 +7,7 @@
 
 from i18n import _
 import struct
-import sys
+import sys, os
 import dispatch, encoding, util
 
 logfile = None
@@ -131,6 +131,7 @@
     based stream to stdout.
     """
     def __init__(self, ui, repo, mode):
+        self.cwd = os.getcwd()
         self.ui = ui
 
         logpath = ui.config("cmdserver", "log", None)
@@ -183,11 +184,15 @@
         self.repo.baseui = copiedui
         self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
 
-        req = dispatch.request(args, copiedui, self.repo, self.cin,
+        req = dispatch.request(args[:], copiedui, self.repo, self.cin,
                                self.cout, self.cerr)
 
         ret = dispatch.dispatch(req) or 0 # might return None
 
+        # restore old cwd
+        if '--cwd' in args:
+            os.chdir(self.cwd)
+
         self.cresult.write(struct.pack('>i', int(ret)))
 
     def getencoding(self):
--- a/mercurial/dispatch.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/dispatch.py	Wed Jul 13 19:30:09 2011 -0500
@@ -633,7 +633,7 @@
     cmdpats = args[:]
     if cmd not in commands.norepo.split():
         # use the repo from the request only if we don't have -R
-        if not rpath:
+        if not rpath and not cwd:
             repo = req.repo
 
         if repo:
--- a/mercurial/localrepo.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/localrepo.py	Wed Jul 13 19:30:09 2011 -0500
@@ -1195,7 +1195,7 @@
         if working: # we need to scan the working dir
             subrepos = []
             if '.hgsub' in self.dirstate:
-                subrepos = ctx1.substate.keys()
+                subrepos = ctx2.substate.keys()
             s = self.dirstate.status(match, subrepos, listignored,
                                      listclean, listunknown)
             cmp, modified, added, removed, deleted, unknown, ignored, clean = s
--- a/mercurial/revset.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/revset.py	Wed Jul 13 19:30:09 2011 -0500
@@ -217,7 +217,7 @@
     """
     try:
         n = int(n[1])
-    except ValueError:
+    except (TypeError, ValueError):
         raise error.ParseError(_("~ expects a number"))
     ps = set()
     cl = repo.changelog
@@ -521,7 +521,7 @@
     try:
         # i18n: "limit" is a keyword
         lim = int(getstring(l[1], _("limit requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "limit" is a keyword
         raise error.ParseError(_("limit expects a number"))
     ss = set(subset)
@@ -537,7 +537,7 @@
     try:
         # i18n: "last" is a keyword
         lim = int(getstring(l[1], _("last requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "last" is a keyword
         raise error.ParseError(_("last expects a number"))
     ss = set(subset)
@@ -676,7 +676,7 @@
         n = int(n[1])
         if n not in (0, 1, 2):
             raise ValueError
-    except ValueError:
+    except (TypeError, ValueError):
         raise error.ParseError(_("^ expects a number 0, 1, or 2"))
     ps = set()
     cl = repo.changelog
@@ -718,7 +718,7 @@
     try:
         # i18n: "rev" is a keyword
         l = int(getstring(l[0], _("rev requires a number")))
-    except ValueError:
+    except (TypeError, ValueError):
         # i18n: "rev" is a keyword
         raise error.ParseError(_("rev expects a number"))
     return [r for r in subset if r == l]
@@ -928,6 +928,14 @@
     elif op == 'group':
         return optimize(x[1], small)
     elif op in 'range list parent ancestorspec':
+        if op == 'parent':
+            # x^:y means (x^) : y, not x ^ (:y)
+            post = ('parentpost', x[1])
+            if x[2][0] == 'dagrangepre':
+                return optimize(('dagrange', post, x[2][1]), small)
+            elif x[2][0] == 'rangepre':
+                return optimize(('range', post, x[2][1]), small)
+
         wa, ta = optimize(x[1], small)
         wb, tb = optimize(x[2], small)
         return wa + wb, (op, ta, tb)
--- a/mercurial/scmutil.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/scmutil.py	Wed Jul 13 19:30:09 2011 -0500
@@ -8,7 +8,7 @@
 from i18n import _
 import util, error, osutil, revset, similar
 import match as matchmod
-import os, errno, stat, sys, glob
+import os, errno, re, stat, sys, glob
 
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked file'''
--- a/mercurial/verify.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/mercurial/verify.py	Wed Jul 13 19:30:09 2011 -0500
@@ -168,6 +168,8 @@
         for c, m in sorted([(c, m) for m in mflinkrevs
                             for c in mflinkrevs[m]]):
             count += 1
+            if m == nullid:
+                continue
             ui.progress(_('crosschecking'), count, total=total)
             err(c, _("changeset refers to unknown manifest %s") % short(m))
         mflinkrevs = None # del is bad here due to scope issues
--- a/tests/test-commandserver.py	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-commandserver.py	Wed Jul 13 19:30:09 2011 -0500
@@ -120,6 +120,15 @@
     runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch))
     runcommand(server, ['log'])
 
+def cwd(server):
+    """ check that --cwd doesn't persist between requests """
+    readchannel(server)
+    os.mkdir('foo')
+    open('foo/bar', 'w').write('a')
+    runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
+    runcommand(server, ['st', 'foo/bar'])
+    os.remove('foo/bar')
+
 if __name__ == '__main__':
     os.system('hg init')
 
@@ -128,3 +137,4 @@
     check(checkruncommand)
     check(inputeof)
     check(serverinput)
+    check(cwd)
--- a/tests/test-commandserver.py.out	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-commandserver.py.out	Wed Jul 13 19:30:09 2011 -0500
@@ -36,3 +36,5 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     1
 
+? bar
+? foo/bar
--- a/tests/test-extension.t	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-extension.t	Wed Jul 13 19:30:09 2011 -0500
@@ -185,7 +185,8 @@
    -R --repository REPO    repository root directory or name of overlay bundle
                            file
       --cwd DIR            change working directory
-   -y --noninteractive     do not prompt, assume 'yes' for any required answers
+   -y --noninteractive     do not prompt, automatically pick the first choice
+                           for all prompts
    -q --quiet              suppress output
    -v --verbose            enable additional output
       --config CONFIG [+]  set/override config option (use 'section.name=value')
@@ -215,7 +216,8 @@
    -R --repository REPO    repository root directory or name of overlay bundle
                            file
       --cwd DIR            change working directory
-   -y --noninteractive     do not prompt, assume 'yes' for any required answers
+   -y --noninteractive     do not prompt, automatically pick the first choice
+                           for all prompts
    -q --quiet              suppress output
    -v --verbose            enable additional output
       --config CONFIG [+]  set/override config option (use 'section.name=value')
--- a/tests/test-help.t	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-help.t	Wed Jul 13 19:30:09 2011 -0500
@@ -247,7 +247,8 @@
    -R --repository REPO    repository root directory or name of overlay bundle
                            file
       --cwd DIR            change working directory
-   -y --noninteractive     do not prompt, assume 'yes' for any required answers
+   -y --noninteractive     do not prompt, automatically pick the first choice
+                           for all prompts
    -q --quiet              suppress output
    -v --verbose            enable additional output
       --config CONFIG [+]  set/override config option (use 'section.name=value')
@@ -331,8 +332,8 @@
    -R --repository REPO      repository root directory or name of overlay bundle
                              file
       --cwd DIR              change working directory
-   -y --noninteractive       do not prompt, assume 'yes' for any required
-                             answers
+   -y --noninteractive       do not prompt, automatically pick the first choice
+                             for all prompts
    -q --quiet                suppress output
    -v --verbose              enable additional output
       --config CONFIG [+]    set/override config option (use
--- a/tests/test-hgcia.t	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-hgcia.t	Wed Jul 13 19:30:09 2011 -0500
@@ -46,9 +46,47 @@
         <author>test</author>
         <version>0:e63c23eaa88a</version>
         <log>foo</log>
-        <url>http://hgserver/$TESTTMP/cia/rev/e63c23eaa88a</url>
-        <files><file uri="http://hgserver/$TESTTMP/cia/file/e63c23eaa88a/foo" action="add">foo</file></files>
+        <url>http://hgserver/rev/e63c23eaa88a</url>
+        <files><file uri="http://hgserver/file/e63c23eaa88a/foo" action="add">foo</file></files>
       </commit>
     </body>
     <timestamp>0</timestamp>
   </message>
+
+  $ cat >> $HGRCPATH <<EOF
+  > strip = 0
+  > EOF
+
+  $ echo bar > bar
+  $ hg ci -Ambar
+  adding bar
+  $ hg push ../cia
+  pushing to ../cia
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  
+  <message>
+    <generator>
+      <name>Mercurial (hgcia)</name>
+      <version>0.1</version>
+      <url>http://hg.kublai.com/mercurial/hgcia</url>
+      <user>testuser</user>
+    </generator>
+    <source>
+  <project>testproject</project>
+  <branch>default</branch>
+  </source>
+    <body>
+      <commit>
+        <author>test</author>
+        <version>1:c0c7cf58edc5</version>
+        <log>bar</log>
+        <url>http://hgserver/$TESTTMP/cia/rev/c0c7cf58edc5</url>
+        <files><file uri="http://hgserver/$TESTTMP/cia/file/c0c7cf58edc5/bar" action="add">bar</file></files>
+      </commit>
+    </body>
+    <timestamp>0</timestamp>
+  </message>
--- a/tests/test-mq-subrepo-svn.t	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-mq-subrepo-svn.t	Wed Jul 13 19:30:09 2011 -0500
@@ -36,7 +36,6 @@
   $ hg add .hgsub
   $ hg status -S -X '**/format'
   A .hgsub
-  ? sub/.svn/entries
   $ hg qnew -m0 0.diff
   committing subrepository sub
   $ cd sub
--- a/tests/test-subrepo-missing.t	Tue Jul 05 17:54:36 2011 -0300
+++ b/tests/test-subrepo-missing.t	Wed Jul 13 19:30:09 2011 -0500
@@ -19,6 +19,7 @@
   $ rm .hgsub
   $ hg revert .hgsub
   warning: subrepo spec file .hgsub not found
+  warning: subrepo spec file .hgsub not found
 
 delete .hgsubstate and revert it
 
@@ -30,8 +31,10 @@
   $ rm .hgsub
   $ hg up 0
   warning: subrepo spec file .hgsub not found
+  warning: subrepo spec file .hgsub not found
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg st
+  warning: subrepo spec file .hgsub not found
   ! .hgsub
   $ ls subrepo
   a
@@ -40,6 +43,7 @@
 
   $ hg up -C
   warning: subrepo spec file .hgsub not found
+  warning: subrepo spec file .hgsub not found
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm .hgsubstate
   $ hg up 0