changeset 13072:8c6b7a5f38c4

merge with stable
author Matt Mackall <mpm@selenic.com>
date Wed, 01 Dec 2010 18:47:40 -0600
parents f553024f1832 (current diff) 5e51254ad4d4 (diff)
children 637627f31c74
files hgext/keyword.py mercurial/commands.py mercurial/util.py
diffstat 13 files changed, 117 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Wed Dec 01 11:04:50 2010 +0100
+++ b/.hgsigs	Wed Dec 01 18:47:40 2010 -0600
@@ -30,3 +30,4 @@
 93d8bff78c96fe7e33237b257558ee97290048a4 0 iD8DBQBMpfvdywK+sNU5EO8RAsxVAJ0UaL1XB51C76JUBhafc9GBefuMxwCdEWkTOzwvE0SarJBe9i008jhbqW4=
 333421b9e0f96c7bc788e5667c146a58a9440a55 0 iD8DBQBMz0HOywK+sNU5EO8RAlsEAJ0USh6yOG7OrWkADGunVt9QimBQnwCbBqeMnKgSbwEw8jZwE3Iz1mdrYlo=
 4438875ec01bd0fc32be92b0872eb6daeed4d44f 0 iD8DBQBM4WYUywK+sNU5EO8RAhCVAJ0dJswachwFAHALmk1x0RJehxzqPQCbBNskP9n/X689jB+btNTZTyKU/fw=
+6aff4f144ad356311318b0011df0bb21f2c97429 0 iD8DBQBM9uxXywK+sNU5EO8RAv+4AKCDj4qKP16GdPaq1tP6BUwpM/M1OACfRyzLPp/qiiN8xJTWoWYSe/XjJug=
--- a/.hgtags	Wed Dec 01 11:04:50 2010 +0100
+++ b/.hgtags	Wed Dec 01 18:47:40 2010 -0600
@@ -42,3 +42,4 @@
 93d8bff78c96fe7e33237b257558ee97290048a4 1.6.4
 333421b9e0f96c7bc788e5667c146a58a9440a55 1.7
 4438875ec01bd0fc32be92b0872eb6daeed4d44f 1.7.1
+6aff4f144ad356311318b0011df0bb21f2c97429 1.7.2
--- a/hgext/keyword.py	Wed Dec 01 11:04:50 2010 +0100
+++ b/hgext/keyword.py	Wed Dec 01 18:47:40 2010 -0600
@@ -86,7 +86,7 @@
 from mercurial import localrepo, match, patch, templatefilters, templater, util
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
-import re, shutil, tempfile
+import os, re, shutil, tempfile
 
 commands.optionalrepo += ' kwdemo'
 
@@ -570,17 +570,31 @@
     def kw_copy(orig, ui, repo, pats, opts, rename=False):
         '''Wraps cmdutil.copy so that copy/rename destinations do not
         contain expanded keywords.
-        Note that the source may also be a symlink as:
+        Note that the source of a regular file destination may also be a
+        symlink:
         hg cp sym x                -> x is symlink
         cp sym x; hg cp -A sym x   -> x is file (maybe expanded keywords)
-        '''
+        For the latter we have to follow the symlink to find out whether its
+        target is configured for expansion and we therefore must unexpand the
+        keywords in the destination.'''
         orig(ui, repo, pats, opts, rename)
         if opts.get('dry_run'):
             return
         wctx = repo[None]
+        cwd = repo.getcwd()
+
+        def haskwsource(dest):
+            '''Returns true if dest is a regular file and configured for
+            expansion or a symlink which points to a file configured for
+            expansion. '''
+            source = repo.dirstate.copied(dest)
+            if 'l' in wctx.flags(source):
+                source = util.canonpath(repo.root, cwd,
+                                        os.path.realpath(source))
+            return kwt.match(source)
+
         candidates = [f for f in repo.dirstate.copies() if
-                      kwt.match(repo.dirstate.copied(f)) and
-                      not 'l' in wctx.flags(f)]
+                      not 'l' in wctx.flags(f) and haskwsource(f)]
         kwt.overwrite(wctx, candidates, False, False)
 
     def kw_dorecord(orig, ui, repo, commitfunc, *pats, **opts):
--- a/hgext/win32mbcs.py	Wed Dec 01 11:04:50 2010 +0100
+++ b/hgext/win32mbcs.py	Wed Dec 01 18:47:40 2010 -0600
@@ -33,7 +33,8 @@
 Note that there are some limitations on using this extension:
 
 - You should use single encoding in one repository.
-
+- If the repository path ends with 0x5c, .hg/hgrc cannot be read.
+- win32mbcs is not compatible with fixutf8 extention.
 
 By default, win32mbcs uses encoding.encoding decided by Mercurial.
 You can specify the encoding by config option::
@@ -48,7 +49,7 @@
 from mercurial.i18n import _
 from mercurial import util, encoding
 
-_encoding = None                                # see reposetup()
+_encoding = None                                # see extsetup
 
 def decode(arg):
     if isinstance(arg, str):
@@ -136,7 +137,7 @@
  sjis s_jis shift_jis_2004 shiftjis2004 sjis_2004 sjis2004
  shift_jisx0213 shiftjisx0213 sjisx0213 s_jisx0213 950 cp950 ms950 '''
 
-def reposetup(ui, repo):
+def extsetup(ui):
     # TODO: decide use of config section for this extension
     if not os.path.supports_unicode_filenames:
         ui.warn(_("[win32mbcs] cannot activate on this platform.\n"))
@@ -149,6 +150,10 @@
         for f in funcs.split():
             wrapname(f, wrapper)
         wrapname("mercurial.osutil.listdir", wrapperforlistdir)
-        ui.debug("[win32mbcs] activated with encoding: %s\n"
-                 % _encoding)
+        # Check sys.args manually instead of using ui.debug() because
+        # command line options is not yet applied when
+        # extensions.loadall() is called.
+        if '--debug' in sys.argv:
+            ui.write("[win32mbcs] activated with encoding: %s\n"
+                     % _encoding)
 
--- a/i18n/pt_BR.po	Wed Dec 01 11:04:50 2010 +0100
+++ b/i18n/pt_BR.po	Wed Dec 01 18:47:40 2010 -0600
@@ -2446,6 +2446,18 @@
 "  quebras de linha seja intencional."
 
 msgid ""
+"The ``win32text.forbid*`` hooks provided by the win32text extension\n"
+"have been unified into a single hook named ``eol.hook``. The hook will\n"
+"lookup the expected line endings from the ``.hgeol`` file, which means\n"
+"you must migrate to a ``.hgeol`` file first before using the hook."
+msgstr ""
+"Os ganchos ``win32text.forbid*`` fornecidos pela extensão win32text\n"
+"foram unificados em um único gancho chamado ``eol.hook``. Esse\n"
+"gancho procura pela configuração de quebra de linha no arquivo\n"
+"``.hgeol``, de modo que você precisa migrar para um arquivo\n"
+"``.hgeol`` para poder usar o gancho."
+
+msgid ""
 "See :hg:`help patterns` for more information about the glob patterns\n"
 "used.\n"
 msgstr ""
@@ -3468,12 +3480,12 @@
 msgid ""
 "The default template mappings (view with :hg:`kwdemo -d`) can be\n"
 "replaced with customized keywords and templates. Again, run\n"
-":hg:`kwdemo` to control the results of your config changes."
+":hg:`kwdemo` to control the results of your configuration changes."
 msgstr ""
 "Os mapeamentos de modelo padrões (veja com :hg:`kwdemo -d`) podem\n"
 "ser substituídos com palavras chave customizáveis e modelos.\n"
 "Novamente, execute :hg:`kwdemo` para controlar os resultados de\n"
-" suas mudanças na configuração."
+"suas mudanças na configuração."
 
 msgid ""
 "Before changing/disabling active keywords, run :hg:`kwshrink` to avoid\n"
@@ -4031,6 +4043,18 @@
 msgid "cannot refresh a revision with children"
 msgstr "não se pode renovar uma revisão com filhos"
 
+#, python-format
+msgid "warning: not refreshing %s\n"
+msgstr "aviso: %s não será atualizado\n"
+
+#, python-format
+msgid "warning: not adding %s\n"
+msgstr "aviso: %s não será adicionado\n"
+
+#, python-format
+msgid "warning: not removing %s\n"
+msgstr "aviso: %s não será removido\n"
+
 msgid "refresh interrupted while patch was popped! (revert --all, qpush to recover)\n"
 msgstr "renovação interrompida enquanto o patch foi desempilhado! (revert --all, qpush para recuperar)\n"
 
@@ -14735,6 +14759,10 @@
 msgid "working directory of %s"
 msgstr "diretório de trabalho de %s"
 
+#, python-format
+msgid "warning: can't find ancestor for '%s' copied from '%s'!\n"
+msgstr "aviso: não é possível encontrar o ancestral de '%s' copiado a partir de '%s'!\n"
+
 msgid "cannot partially commit a merge (do not specify files or patterns)"
 msgstr "não é possível consolidar parcialmente uma mesclagem (não especifique arquivos ou padrões)"
 
@@ -15653,6 +15681,10 @@
 msgstr "entrada inválida na fncache, linha %s"
 
 #, python-format
+msgid "warning: subrepo spec file %s not found\n"
+msgstr "aviso: arquivo spec de sub-repositório %s não encontrado\n"
+
+#, python-format
 msgid "subrepo spec file %s not found"
 msgstr "arquivo spec de sub-repositório %s não encontrado"
 
--- a/mercurial/commands.py	Wed Dec 01 11:04:50 2010 +0100
+++ b/mercurial/commands.py	Wed Dec 01 18:47:40 2010 -0600
@@ -3327,7 +3327,7 @@
     """start stand-alone webserver
 
     Start a local HTTP repository browser and pull server. You can use
-    this for ad-hoc sharing and browing of repositories. It is
+    this for ad-hoc sharing and browsing of repositories. It is
     recommended to use a real web server to serve a repository for
     longer periods of time.
 
--- a/mercurial/hgweb/hgwebdir_mod.py	Wed Dec 01 11:04:50 2010 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py	Wed Dec 01 18:47:40 2010 -0600
@@ -153,10 +153,11 @@
                 # nested indexes and hgwebs
 
                 repos = dict(self.repos)
-                while virtual:
-                    real = repos.get(virtual)
+                virtualrepo = virtual
+                while virtualrepo:
+                    real = repos.get(virtualrepo)
                     if real:
-                        req.env['REPO_NAME'] = virtual
+                        req.env['REPO_NAME'] = virtualrepo
                         try:
                             repo = hg.repository(self.ui, real)
                             return hgweb(repo).run_wsgi(req)
@@ -166,16 +167,16 @@
                         except error.RepoError, inst:
                             raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
 
-                    # browse subdirectories
-                    subdir = virtual + '/'
-                    if [r for r in repos if r.startswith(subdir)]:
-                        req.respond(HTTP_OK, ctype)
-                        return self.makeindex(req, tmpl, subdir)
-
-                    up = virtual.rfind('/')
+                    up = virtualrepo.rfind('/')
                     if up < 0:
                         break
-                    virtual = virtual[:up]
+                    virtualrepo = virtualrepo[:up]
+
+                # browse subdirectories
+                subdir = virtual + '/'
+                if [r for r in repos if r.startswith(subdir)]:
+                    req.respond(HTTP_OK, ctype)
+                    return self.makeindex(req, tmpl, subdir)
 
                 # prefixes not found
                 req.respond(HTTP_NOT_FOUND, ctype)
--- a/mercurial/util.py	Wed Dec 01 11:04:50 2010 +0100
+++ b/mercurial/util.py	Wed Dec 01 18:47:40 2010 -0600
@@ -833,6 +833,7 @@
 
 def makedirs(name, mode=None):
     """recursive directory creation with parent mode inheritance"""
+    parent = os.path.abspath(os.path.dirname(name))
     try:
         os.mkdir(name)
         if mode is not None:
@@ -841,9 +842,8 @@
     except OSError, err:
         if err.errno == errno.EEXIST:
             return
-        if not name or err.errno != errno.ENOENT:
+        if not name or parent == name or err.errno != errno.ENOENT:
             raise
-    parent = os.path.abspath(os.path.dirname(name))
     makedirs(parent, mode)
     makedirs(name, mode)
 
@@ -1015,7 +1015,11 @@
         tz = time.altzone
     else:
         tz = time.timezone
-    return time.mktime(lt), tz
+    t = time.mktime(lt)
+    if t < 0:
+        hint = _("check your clock")
+        raise Abort(_("negative timestamp: %d") % t, hint=hint)
+    return t, tz
 
 def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'):
     """represent a (unixtime, offset) tuple as a localized time.
@@ -1116,6 +1120,8 @@
     # to UTC+14
     if abs(when) > 0x7fffffff:
         raise Abort(_('date exceeds 32 bits: %d') % when)
+    if when < 0:
+        raise Abort(_('negative date value: %d') % when)
     if offset < -50400 or offset > 43200:
         raise Abort(_('impossible time zone offset: %d') % offset)
     return when, offset
--- a/tests/test-commit.t	Wed Dec 01 11:04:50 2010 +0100
+++ b/tests/test-commit.t	Wed Dec 01 18:47:40 2010 -0600
@@ -22,6 +22,9 @@
   $ hg commit -d '111111111111 0' -m commit-7
   abort: date exceeds 32 bits: 111111111111
   [255]
+  $ hg commit -d '-7654321 3600' -m commit-7
+  abort: negative date value: -7654321
+  [255]
 
 commit added file that has been deleted
 
--- a/tests/test-hgwebdir.t	Wed Dec 01 11:04:50 2010 +0100
+++ b/tests/test-hgwebdir.t	Wed Dec 01 18:47:40 2010 -0600
@@ -77,7 +77,7 @@
   404 Not Found
   
   
-  error: repository c not found
+  error: repository c/file/tip/c not found
   [1]
 
 atom-log without basedir
--- a/tests/test-hgwebdirsym.t	Wed Dec 01 11:04:50 2010 +0100
+++ b/tests/test-hgwebdirsym.t	Wed Dec 01 18:47:40 2010 -0600
@@ -56,19 +56,19 @@
   404 Not Found
   
   
-  error: repository circle not found
+  error: repository circle/al/file/tip/a not found
   [1]
   $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
   404 Not Found
   
   
-  error: repository circle not found
+  error: repository circle/b/file/tip/a not found
   [1]
   $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
   404 Not Found
   
   
-  error: repository circle not found
+  error: repository circle/c/file/tip/a not found
   [1]
 
 collections errors
--- a/tests/test-keyword.t	Wed Dec 01 11:04:50 2010 +0100
+++ b/tests/test-keyword.t	Wed Dec 01 18:47:40 2010 -0600
@@ -553,7 +553,8 @@
   $ hg forget i
   $ rm i
 
-cp symlink (becomes regular file), and hg copy after
+cp symlink file; hg cp -A symlink file (part1)
+- copied symlink points to kwfile: overwrite
 
   $ cp sym i
   $ ls -l i
@@ -602,6 +603,26 @@
   $ hg update --clean
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+cp symlink file; hg cp -A symlink file (part2)
+- copied symlink points to kw ignored file: do not overwrite
+
+  $ cat a > i
+  $ ln -s i symignored
+  $ hg commit -Am 'fake expansion in ignored and symlink' i symignored
+  $ cp symignored x
+  $ hg copy --after --verbose symignored x
+  copying symignored to x
+  $ head -n 1 x
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  $ hg forget x
+  $ rm x
+
+  $ hg rollback
+  rolling back to revision 1 (undo commit)
+  $ hg update --clean
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ rm i symignored
+
 Custom keywordmaps as argument to kwdemo
 
   $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
--- a/tests/test-mq-qrefresh.t	Wed Dec 01 11:04:50 2010 +0100
+++ b/tests/test-mq-qrefresh.t	Wed Dec 01 18:47:40 2010 -0600
@@ -550,9 +550,7 @@
   $ hg qrefresh
   warning: not removing .hgsub
   warning: not removing .hgsubstate
-  refresh interrupted while patch was popped! (revert --all, qpush to recover)
-  abort: No such file or directory: $TESTTMP/repo-2499/.hgsub
-  [255]
+  warning: subrepo spec file .hgsub not found
   $ hg status
   ! .hgsub
   ! .hgsubstate