changeset 10477:44b4a2a31623 stable

Merge with default
author Martin Geisler <mg@lazybytes.net>
date Mon, 15 Feb 2010 00:14:16 +0100
parents 3113736dbac5 (diff) 2253715fde97 (current diff)
children ed4de30e16c5 bb508b312359
files hgext/color.py tests/test-issue352 tests/test-issue352.out
diffstat 25 files changed, 186 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/win32/mercurial.ini	Sun Feb 14 17:08:52 2010 -0500
+++ b/contrib/win32/mercurial.ini	Mon Feb 15 00:14:16 2010 +0100
@@ -57,6 +57,7 @@
 ;pager =
 ;parentrevspec =
 ;patchbomb =
+;progress =
 ;purge =
 ;rebase =
 ;record =
--- a/hgext/bookmarks.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/bookmarks.py	Mon Feb 15 00:14:16 2010 +0100
@@ -30,7 +30,7 @@
 
 from mercurial.i18n import _
 from mercurial.node import nullid, nullrev, hex, short
-from mercurial import util, commands, localrepo, repair, extensions
+from mercurial import util, commands, repair, extensions
 import os
 
 def write(repo):
--- a/hgext/color.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/color.py	Mon Feb 15 00:14:16 2010 +0100
@@ -65,7 +65,7 @@
 
 import os, sys
 
-from mercurial import cmdutil, commands, extensions, error
+from mercurial import cmdutil, commands, extensions
 from mercurial.i18n import _
 
 # start and stop parameters for effects
--- a/hgext/inotify/__init__.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/inotify/__init__.py	Mon Feb 15 00:14:16 2010 +0100
@@ -11,7 +11,6 @@
 # todo: socket permissions
 
 from mercurial.i18n import _
-from mercurial import cmdutil, util
 import server
 from client import client, QueryFailed
 
--- a/hgext/inotify/linuxserver.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/inotify/linuxserver.py	Mon Feb 15 00:14:16 2010 +0100
@@ -8,7 +8,6 @@
 
 from mercurial.i18n import _
 from mercurial import osutil, util
-import common
 import server
 import errno, os, select, stat, sys, time
 
--- a/hgext/interhg.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/interhg.py	Mon Feb 15 00:14:16 2010 +0100
@@ -40,7 +40,7 @@
 
 templatefilters.filters["escape"] = interhg_escape
 
-def interhg_refresh(orig, self):
+def interhg_refresh(orig, self, *args, **kwargs):
     interhg_table[:] = []
     for key, pattern in self.repo.ui.configitems('interhg'):
         # grab the delimiter from the character after the "s"
@@ -75,6 +75,6 @@
         except re.error:
             self.repo.ui.warn(_("interhg: invalid regexp for %s: %s\n")
                               % (key, regexp))
-    return orig(self)
+    return orig(self, *args, **kwargs)
 
 extensions.wrapfunction(hgweb_mod.hgweb, 'refresh', interhg_refresh)
--- a/hgext/mq.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/mq.py	Mon Feb 15 00:14:16 2010 +0100
@@ -2152,7 +2152,7 @@
 
     To set guards on another patch::
 
-      hg qguard -- other.patch +2.6.17 -stable
+      hg qguard other.patch -- +2.6.17 -stable
     '''
     def status(idx):
         guards = q.series_guards[idx] or ['unguarded']
@@ -2721,7 +2721,7 @@
         (guard,
          [('l', 'list', None, _('list all patches and guards')),
           ('n', 'none', None, _('drop all guards'))],
-         _('hg qguard [-l] [-n] -- [PATCH] [+GUARD]... [-GUARD]...')),
+         _('hg qguard [-l] [-n] [PATCH] [-- [+GUARD]... [-GUARD]...]')),
     'qheader': (header, [], _('hg qheader [PATCH]')),
     "^qimport":
         (qimport,
--- a/hgext/progress.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/hgext/progress.py	Mon Feb 15 00:14:16 2010 +0100
@@ -33,13 +33,12 @@
                  # (that is, min(width, term width) will be used)
   clear-complete = True # clear the progress bar after it's done
 
-Valid entries for the format field are topic, bar, number, unit, and item.
-item defaults to the last 20 characters of the item, but this can be
-changed by adding either -<num> which would take the last num characters,
-or +<num> for the first num characters.
+Valid entries for the format field are topic, bar, number, unit, and
+item. item defaults to the last 20 characters of the item, but this
+can be changed by adding either ``-<num>`` which would take the last
+num characters, or ``+<num>`` for the first num characters.
 """
 
-import math
 import sys
 import time
 
@@ -157,7 +156,8 @@
             if topic not in self.topics:
                 self.topics.append(topic)
             now = time.time()
-            if now - self.lastprint > 0.1 and topic == self.topics[-1]:
+            if (now - self.lastprint >= self.refresh
+                and topic == self.topics[-1]):
                 self.lastprint = now
                 self.show(topic, pos, item, unit, total)
         return orig(topic, pos, item=item, unit=unit, total=total)
--- a/mercurial/cmdutil.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/mercurial/cmdutil.py	Mon Feb 15 00:14:16 2010 +0100
@@ -7,7 +7,7 @@
 
 from node import hex, nullid, nullrev, short
 from i18n import _
-import os, sys, errno, re, glob, tempfile, time
+import os, sys, errno, re, glob, tempfile
 import mdiff, bdiff, util, templater, patch, error, encoding, templatekw
 import match as _match
 
--- a/mercurial/copies.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/mercurial/copies.py	Mon Feb 15 00:14:16 2010 +0100
@@ -5,7 +5,6 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from i18n import _
 import util
 import heapq
 
--- a/mercurial/patch.py	Sun Feb 14 17:08:52 2010 -0500
+++ b/mercurial/patch.py	Mon Feb 15 00:14:16 2010 +0100
@@ -1435,9 +1435,6 @@
     copy = {}
     if opts.git or opts.upgrade:
         copy = copies.copies(repo, ctx1, ctx2, repo[nullid])[0]
-        copy = copy.copy()
-        for k, v in copy.items():
-            copy[v] = k
 
     difffn = lambda opts, losedata: trydiff(repo, revs, ctx1, ctx2,
                  modified, added, removed, copy, getfilectx, opts, losedata)
@@ -1467,6 +1464,8 @@
     gone = set()
     gitmode = {'l': '120000', 'x': '100755', '': '100644'}
 
+    copyto = dict([(v, k) for k, v in copy.items()])
+
     if opts.git:
         revs = None
 
@@ -1483,9 +1482,12 @@
         if opts.git or losedatafn:
             if f in added:
                 mode = gitmode[ctx2.flags(f)]
-                if f in copy:
+                if f in copy or f in copyto:
                     if opts.git:
-                        a = copy[f]
+                        if f in copy:
+                            a = copy[f]
+                        else:
+                            a = copyto[f]
                         omode = gitmode[man1.flags(a)]
                         _addmodehdr(header, omode, mode)
                         if a in removed and a not in gone:
@@ -1514,7 +1516,10 @@
             elif f in removed:
                 if opts.git:
                     # have we already reported a copy above?
-                    if f in copy and copy[f] in added and copy[copy[f]] == f:
+                    if ((f in copy and copy[f] in added
+                         and copyto[copy[f]] == f) or
+                        (f in copyto and copyto[f] in added
+                         and copy[copyto[f]] == f)):
                         dodiff = False
                     else:
                         header.append('deleted file mode %s\n' %
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/filtertmp.py	Mon Feb 15 00:14:16 2010 +0100
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+#
+# This used to be a simple sed call like:
+#
+#  $ sed "s:$HGTMP:*HGTMP*:"
+#
+# But $HGTMP has ':' under Windows which breaks the sed call.
+#
+import sys, os
+
+input = sys.stdin.read()
+input = input.replace(os.sep, '/')
+hgtmp = os.environ['HGTMP'].replace(os.sep, '/')
+input = input.replace(hgtmp, '$HGTMP')
+sys.stdout.write(input)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-interhg	Mon Feb 15 00:14:16 2010 +0100
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+hg init test
+cd test
+
+cat > .hg/hgrc <<EOF
+[extensions]
+interhg =
+
+[interhg]
+issues = s|Issue(\d+)|<a href="http://bts.example.org/issue\1">Issue\1</a>|
+
+# yes, 'x' is a weird delimiter...
+markbugs = sxbugx<i class="\x">bug</i>x
+EOF
+
+touch foo
+hg add foo
+hg commit -d '1 0' -m 'Issue123: fixed the bug!'
+
+hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+cat hg.pid >> $DAEMON_PIDS
+
+echo % log
+"$TESTDIR/get-with-headers.py" localhost:$HGPORT '/' | grep bts
+
+echo % errors
+cat errors.log
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-interhg.out	Mon Feb 15 00:14:16 2010 +0100
@@ -0,0 +1,3 @@
+% log
+  <td class="description"><a href="/rev/1b0e7ece6bd6"><a href="http://bts.example.org/issue123">Issue123</a>: fixed the <i class="x">bug</i>!</a><span class="branchhead">default</span> <span class="tag">tip</span> </td>
+% errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-progress	Mon Feb 15 00:14:16 2010 +0100
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+cat > loop.py <<EOF
+from mercurial import commands
+
+def loop(ui, loops, **opts):
+    loops = int(loops)
+    total = None
+    if loops >= 0:
+        total = loops
+    loops = abs(loops)
+
+    for i in range(loops):
+        ui.progress('loop', i, 'loop.%d' % i, 'loopnum', total)
+    ui.progress('loop', None, 'loop.done', 'loopnum', total)
+
+commands.norepo += " loop"
+
+cmdtable = {
+    "loop": (loop, [], 'hg loop LOOPS'),
+}
+EOF
+
+cat > filtercr.py <<EOF
+import sys, re
+for line in sys.stdin:
+    line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
+    sys.stdout.write(line)
+EOF
+
+echo "[extensions]" >> $HGRCPATH
+echo "progress=" >> $HGRCPATH
+echo "loop=" `pwd`/loop.py >> $HGRCPATH
+echo "[ui]" >> $HGRCPATH
+echo "interactive=1" >> $HGRCPATH
+
+echo '% test default params, display nothing because of delay'
+hg -y loop 3 | python filtercr.py
+
+echo "[progress]" >> $HGRCPATH
+echo "delay=0" >> $HGRCPATH
+echo "refresh=0" >> $HGRCPATH
+
+echo '% test with delay=0, refresh=0'
+hg -y loop 3 | python filtercr.py
+
+echo '% test refresh is taken in account'
+hg -y --config progress.refresh=100 loop 3 | python filtercr.py
+
+echo '% test format options 1'
+hg -y --config 'progress.format=number topic item+2' loop 2 | python filtercr.py
+
+echo '% test format options 2'
+hg -y --config 'progress.format=number item-3 bar' loop 2 | python filtercr.py
+
+echo '% test format options and indeterminate progress'
+hg -y --config 'progress.format=number item bar' loop -- -2 | python filtercr.py
+
+echo '% test immediate progress completion'
+hg -y loop 0 | python filtercr.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-progress.out	Mon Feb 15 00:14:16 2010 +0100
@@ -0,0 +1,20 @@
+% test default params, display nothing because of delay
+% test with delay=0, refresh=0
+
+loop [                                                                    ] 0/3
+loop [=====================>                                              ] 1/3
+loop [============================================>                       ] 2/3
+                                                                                
% test refresh is taken in account
+% test format options 1
+
+0/2 loop lo
+1/2 loop lo
+                                                                                
% test format options 2
+
+0/2 p.0 [                                                                     ]
+1/2 p.1 [=================================>                                   ]
+                                                                                
% test format options and indeterminate progress
+
+0 loop.0               [ <=>                                                  ]
+1 loop.1               [  <=>                                                 ]
+                                                                                
% test immediate progress completion
--- a/tests/test-pull	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-pull	Mon Feb 15 00:14:16 2010 +0100
@@ -26,6 +26,10 @@
 hg pull -u ../test
 
 echo % test file: uri handling
-hg pull -q file://../test-doesnt-exist
+hg pull -q file://../test-doesnt-exist 2>&1 \
+    | sed 's%abort: repository.*/test-doesnt-exist%abort: repository /test-doesnt-exist%'
 hg pull -q file:../test
-hg pull -q file://foobar`pwd`/../test
+# It's tricky to make file:// URLs working on every platforms
+# with regular shell commands.
+URL=`python -c "import os; print 'file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test'"`
+hg pull -q $URL
--- a/tests/test-push-validation	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-push-validation	Mon Feb 15 00:14:16 2010 +0100
@@ -1,7 +1,5 @@
 #!/bin/sh
 
-STRIP=`pwd`
-
 hg init test
 cd test
 cat > .hg/hgrc <<EOF
@@ -21,4 +19,4 @@
 echo blah >> beta
 hg ci -m '2 (corrupt)'
 mv tmp .hg/store/data/beta.i
-hg push 2>&1 | sed "s%$STRIP%test-root%"
+hg push 2>&1 | "$TESTDIR/filtertmp.py"
--- a/tests/test-push-validation.out	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-push-validation.out	Mon Feb 15 00:14:16 2010 +0100
@@ -2,7 +2,7 @@
 adding beta
 updating to branch default
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-pushing to test-root/test
+pushing to $HGTMP/test-push-validation/test
 searching for changes
 adding changesets
 adding manifests
--- a/tests/test-rename	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-rename	Mon Feb 15 00:14:16 2010 +0100
@@ -210,6 +210,13 @@
 hg status -C
 hg update -C
 
+echo '# overwriting with renames (issue1959)'
+hg rename d1/a d1/c
+hg rename d1/b d1/a
+hg status -C
+hg diff --git
+hg update -C
+
 echo "# check illegal path components"
 
 hg rename d1/d11/a1 .hg/foo
--- a/tests/test-rename.out	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-rename.out	Mon Feb 15 00:14:16 2010 +0100
@@ -300,6 +300,19 @@
 # idempotent renames (d1/b -> d1/bb followed by d1/bb -> d1/b)
 M d1/b
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+# overwriting with renames (issue1959)
+A d1/a
+  d1/b
+A d1/c
+  d1/a
+R d1/b
+diff --git a/d1/b b/d1/a
+rename from d1/b
+rename to d1/a
+diff --git a/d1/a b/d1/c
+copy from d1/a
+copy to d1/c
+2 files updated, 0 files merged, 1 files removed, 0 files unresolved
 # check illegal path components
 abort: path contains illegal component: .hg/foo
 abort: ../foo not under root
--- a/tests/test-share	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-share	Mon Feb 15 00:14:16 2010 +0100
@@ -19,7 +19,7 @@
   && echo "fail: .hg/store should not exist" \
   || echo "pass: .hg/store does not exist"
 # Some sed versions appends newline, some don't, and some just fails
-(cat .hg/sharedpath; echo) | head -n1 | sed "s:$HGTMP:*HGTMP*:"
+(cat .hg/sharedpath; echo) | head -n1 | "$TESTDIR/filtertmp.py"
 
 echo % commit in shared clone
 echo a >> a
--- a/tests/test-share.out	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-share.out	Mon Feb 15 00:14:16 2010 +0100
@@ -5,7 +5,7 @@
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % contents of repo2/.hg
 pass: .hg/store does not exist
-*HGTMP*/test-share/repo1/.hg
+$HGTMP/test-share/repo1/.hg
 % commit in shared clone
 % check original
 changeset:   1:8af4dc49db9e
--- a/tests/test-subrepo	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-subrepo	Mon Feb 15 00:14:16 2010 +0100
@@ -180,7 +180,9 @@
 hg -R main ci -m "add subrepos"
 cd ..
 hg clone mercurial/main mercurial2/main
-cat mercurial2/main/nested_absolute/.hg/hgrc mercurial2/main/nested_relative/.hg/hgrc | sed "s:${PWD}:/tmp:"
+cat mercurial2/main/nested_absolute/.hg/hgrc \
+    mercurial2/main/nested_relative/.hg/hgrc \
+    | "$TESTDIR/filtertmp.py"
 rm -rf mercurial mercurial2
 
 exit 0
--- a/tests/test-subrepo.out	Sun Feb 14 17:08:52 2010 -0500
+++ b/tests/test-subrepo.out	Mon Feb 15 00:14:16 2010 +0100
@@ -256,6 +256,6 @@
 updating to branch default
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 [paths]
-default = /tmp/mercurial/main/nested_absolute
+default = $HGTMP/test-subrepo/sub/mercurial/main/nested_absolute
 [paths]
-default = /tmp/mercurial/main/nested_relative
+default = $HGTMP/test-subrepo/sub/mercurial/main/nested_relative