Mercurial > hg
changeset 17470:89467a7c2132
Merge with crew
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Mon, 10 Sep 2012 14:08:10 -0700 |
parents | 8fea378242e3 (diff) fb72eec7efd8 (current diff) |
children | ad1561723dde |
files | |
diffstat | 19 files changed, 114 insertions(+), 72 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/bash_completion Tue Aug 28 20:52:04 2012 +0200 +++ b/contrib/bash_completion Mon Sep 10 14:08:10 2012 -0700 @@ -386,6 +386,13 @@ fi } +_hg_cmd_rebase() { + if [[ "$prev" = @(-s|--source|-d|--dest|-b|--base|-r|--rev) ]]; then + _hg_labels + return + fi +} + _hg_cmd_strip() { _hg_labels
--- a/mercurial/cmdutil.py Tue Aug 28 20:52:04 2012 +0200 +++ b/mercurial/cmdutil.py Mon Sep 10 14:08:10 2012 -0700 @@ -10,7 +10,7 @@ import os, sys, errno, re, tempfile import util, scmutil, templater, patch, error, templatekw, revlog, copies import match as matchmod -import subrepo, context, repair, bookmarks, graphmod, revset +import subrepo, context, repair, bookmarks, graphmod, revset, phases def parsealiases(cmd): return cmd.lstrip("^").split("|") @@ -1675,7 +1675,12 @@ user=user, date=date, extra=extra) - newid = repo.commitctx(new) + ph = repo.ui.config('phases', 'new-commit', phases.draft) + try: + repo.ui.setconfig('phases', 'new-commit', old.phase()) + newid = repo.commitctx(new) + finally: + repo.ui.setconfig('phases', 'new-commit', ph) if newid != old.node(): # Reroute the working copy parent to the new changeset repo.setparents(newid, nullid)
--- a/tests/hghave.py Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/hghave.py Mon Sep 10 14:08:10 2012 -0700 @@ -118,6 +118,9 @@ except OSError: return False +def has_killdaemons(): + return True + def has_cacheable_fs(): from mercurial import util @@ -286,6 +289,7 @@ "hardlink": (has_hardlink, "hardlinks"), "icasefs": (has_icasefs, "case insensitive file system"), "inotify": (has_inotify, "inotify extension support"), + "killdaemons": (has_killdaemons, 'killdaemons.py support'), "lsprof": (has_lsprof, "python lsprof module"), "mtn": (has_mtn, "monotone client (>= 1.0)"), "outer-repo": (has_outer_repo, "outer repo"),
--- a/tests/killdaemons.py Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/killdaemons.py Mon Sep 10 14:08:10 2012 -0700 @@ -1,25 +1,54 @@ #!/usr/bin/env python -import os, time, errno, signal +import os, sys, time, errno, signal -# Kill off any leftover daemon processes -try: - fp = open(os.environ['DAEMON_PIDS']) - for line in fp: - try: - pid = int(line) - except ValueError: - continue +if os.name =='nt': + import ctypes + def kill(pid, logfn, tryhard=True): + logfn('# Killing daemon process %d' % pid) + PROCESS_TERMINATE = 1 + handle = ctypes.windll.kernel32.OpenProcess( + PROCESS_TERMINATE, False, pid) + ctypes.windll.kernel32.TerminateProcess(handle, -1) + ctypes.windll.kernel32.CloseHandle(handle) +else: + def kill(pid, logfn, tryhard=True): try: os.kill(pid, 0) + logfn('# Killing daemon process %d' % pid) os.kill(pid, signal.SIGTERM) - for i in range(10): - time.sleep(0.05) + if tryhard: + for i in range(10): + time.sleep(0.05) + os.kill(pid, 0) + else: + time.sleep(0.1) os.kill(pid, 0) + logfn('# Daemon process %d is stuck - really killing it' % pid) os.kill(pid, signal.SIGKILL) except OSError, err: if err.errno != errno.ESRCH: raise - fp.close() -except IOError: - pass + +def killdaemons(pidfile, tryhard=True, remove=False, logfn=None): + if not logfn: + logfn = lambda s: s + # Kill off any leftover daemon processes + try: + fp = open(pidfile) + for line in fp: + try: + pid = int(line) + except ValueError: + continue + kill(pid, logfn, tryhard) + fp.close() + if remove: + os.unlink(pidfile) + except IOError: + pass + +if __name__ == '__main__': + path, = sys.argv[1:] + killdaemons(path) +
--- a/tests/run-tests.py Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/run-tests.py Mon Sep 10 14:08:10 2012 -0700 @@ -54,6 +54,7 @@ import time import re import threading +import killdaemons as killmod processlock = threading.Lock() @@ -348,29 +349,8 @@ pass def killdaemons(): - # Kill off any leftover daemon processes - try: - fp = open(DAEMON_PIDS) - for line in fp: - try: - pid = int(line) - except ValueError: - continue - try: - os.kill(pid, 0) - vlog('# Killing daemon process %d' % pid) - os.kill(pid, signal.SIGTERM) - time.sleep(0.1) - os.kill(pid, 0) - vlog('# Daemon process %d is stuck - really killing it' % pid) - os.kill(pid, signal.SIGKILL) - except OSError, err: - if err.errno != errno.ESRCH: - raise - fp.close() - os.unlink(DAEMON_PIDS) - except IOError: - pass + return killmod.killdaemons(DAEMON_PIDS, tryhard=False, remove=True, + logfn=vlog) def cleanup(options): if not options.keep_tmpdir:
--- a/tests/test-archive.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-archive.t Mon Sep 10 14:08:10 2012 -0700 @@ -24,7 +24,7 @@ > echo % $3 and $4 disallowed should both give 403 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$3" | head -n 1 > "$TESTDIR/get-with-headers.py" localhost:$HGPORT "archive/tip.$4" | head -n 1 - > "$TESTDIR/killdaemons.py" + > "$TESTDIR/killdaemons.py" $DAEMON_PIDS > cat errors.log > cp .hg/hgrc-base .hg/hgrc > } @@ -93,7 +93,7 @@ testing: test-archive-2c0277f05ed4/foo OK No errors detected in compressed data of archive.zip. - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ hg archive -t tar test.tar $ tar tf test.tar
--- a/tests/test-commit-amend.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-commit-amend.t Mon Sep 10 14:08:10 2012 -0700 @@ -25,7 +25,7 @@ $ cat >> $HGRCPATH <<EOF > [hooks] - > pretxncommit.foo = sh -c "echo \"pretxncommit \$HG_NODE\"; hg id -r \$HG_NODE" + > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" > EOF Amending changeset with changes in working dir: @@ -355,3 +355,18 @@ $ hg log -r . --debug | grep extra extra: branch=a extra: source=2647734878ef0236dda712fae9c1651cf694ea8a + +Preserve phase + + $ hg phase '.^::.' + 11: draft + 13: draft + $ hg phase --secret --force . + $ hg phase '.^::.' + 11: draft + 13: secret + $ hg commit --amend -m 'amend for phase' -q + $ hg phase '.^::.' + 11: draft + 13: secret +
--- a/tests/test-hgweb-commands.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-hgweb-commands.t Mon Sep 10 14:08:10 2012 -0700 @@ -1260,7 +1260,7 @@ Stop and restart with HGENCODING=cp932 and preferuncompressed - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ HGENCODING=cp932 hg serve --config server.preferuncompressed=True -n test \ > -p $HGPORT -d --pid-file=hg.pid -E errors.log $ cat hg.pid >> $DAEMON_PIDS @@ -1288,7 +1288,7 @@ ERRORS ENCOUNTERED $ cat errors.log - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cd ..
--- a/tests/test-hgweb-diffs.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-hgweb-diffs.t Mon Sep 10 14:08:10 2012 -0700 @@ -291,7 +291,7 @@ set up hgweb with git diffs - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ hg serve --config 'diff.git=1' -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS @@ -936,7 +936,7 @@ raw revision with diff block numbers - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat <<EOF > .hg/hgrc > [web] > templates = rawdiff @@ -973,7 +973,7 @@ @@ -0,0 +1,1 @@ +b - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ rm .hg/hgrc rawdiff/map $ rmdir rawdiff $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
--- a/tests/test-hgweb.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-hgweb.t Mon Sep 10 14:08:10 2012 -0700 @@ -299,7 +299,7 @@ stop and restart - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log $ cat hg.pid >> $DAEMON_PIDS
--- a/tests/test-hgwebdir.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-hgwebdir.t Mon Sep 10 14:08:10 2012 -0700 @@ -657,7 +657,7 @@ Test collapse = True - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat >> paths.conf <<EOF > [web] > collapse=true @@ -723,7 +723,7 @@ Test descend = False - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat >> paths.conf <<EOF > descend=false > EOF @@ -784,7 +784,7 @@ $ hg id http://localhost:$HGPORT1/astar 8580ff50825a - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat > paths.conf <<EOF > [paths] > t/a = $root/a @@ -812,7 +812,7 @@ Test collapse = True - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat >> paths.conf <<EOF > [web] > collapse=true @@ -837,7 +837,7 @@ test descend = False - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat >> paths.conf <<EOF > descend=false > EOF @@ -857,7 +857,7 @@ /t/a/ /t/b/ - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ cat > paths.conf <<EOF > [paths] > nostore = $root/nostore @@ -956,7 +956,7 @@ $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT2 'a/rss-log' | grep '<guid' <guid isPermaLink="true">http://hg.example.com:8080/a/rev/8580ff50825a</guid> - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS $ hg serve --config web.baseurl=http://hg.example.com:8080/foo/ -p $HGPORT2 -d \ > --pid-file=hg.pid --webdir-conf collections.conf \ > -A access-collections-2.log -E error-collections-2.log
--- a/tests/test-highlight.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-highlight.t Mon Sep 10 14:08:10 2012 -0700 @@ -545,7 +545,7 @@ errors encountered $ cat errors.log - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS Change the pygments style @@ -579,7 +579,7 @@ $ hg ci -Ama adding eucjp.txt $ hgserveget () { - > "$TESTDIR/killdaemons.py" + > "$TESTDIR/killdaemons.py" $DAEMON_PIDS > echo % HGENCODING="$1" hg serve > HGENCODING="$1" hg serve -p $HGPORT -d -n test --pid-file=hg.pid -E errors.log > cat hg.pid >> $DAEMON_PIDS
--- a/tests/test-http-branchmap.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-http-branchmap.t Mon Sep 10 14:08:10 2012 -0700 @@ -1,7 +1,10 @@ - $ "$TESTDIR/hghave" serve || exit 80 + $ "$TESTDIR/hghave" killdaemons || exit 80 $ hgserve() { - > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid -E errors.log -v $@ + > hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid \ + > -E errors.log -v $@ > startup.log + > # Grepping hg serve stdout would hang on Windows + > grep -v 'listening at' startup.log > cat hg.pid >> "$DAEMON_PIDS" > } $ hg init a @@ -12,7 +15,6 @@ $ hg -R a ci -Am foo adding foo $ hgserve -R a --config web.push_ssl=False --config web.allow_push=* --encoding latin1 - listening at http://*:$HGPORT1/ (bound to 127.0.0.1:$HGPORT1) (glob) $ hg --encoding utf-8 clone http://localhost:$HGPORT1 b requesting all changes adding changesets @@ -52,7 +54,7 @@ date: Thu Jan 01 00:00:00 1970 +0000 summary: foo - $ kill `cat hg.pid` + $ "$TESTDIR/killdaemons.py" hg.pid verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
--- a/tests/test-largefiles.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-largefiles.t Mon Sep 10 14:08:10 2012 -0700 @@ -13,7 +13,7 @@ > patterns=glob:**.dat > usercache=${USERCACHE} > [hooks] - > precommit=sh -c "echo \"Invoking status precommit hook\"; hg status" + > precommit=sh -c "echo \\"Invoking status precommit hook\\"; hg status" > EOF Create the repo with a couple of revisions of both large and normal @@ -200,7 +200,7 @@ -rw-r--r-- 9 normal4 - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS #endif Test archiving the various revisions. These hit corner cases known with @@ -434,7 +434,7 @@ $ cd ../addrm $ cat >> .hg/hgrc <<EOF > [hooks] - > post-commit.stat=sh -c "echo \"Invoking status postcommit hook\"; hg status -A" + > post-commit.stat=sh -c "echo \\"Invoking status postcommit hook\\"; hg status -A" > EOF $ touch foo $ hg add --large foo @@ -1166,7 +1166,7 @@ [255] used all HGPORTs, kill all daemons - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS #endif vanilla clients locked out from largefiles ssh repos @@ -1252,7 +1252,7 @@ $ rm -rf empty used all HGPORTs, kill all daemons - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS #endif
--- a/tests/test-pull-http.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-pull-http.t Mon Sep 10 14:08:10 2012 -0700 @@ -28,7 +28,7 @@ $ cat test3/.hg/hgrc [paths] default = http://foo@localhost:$HGPORT/ - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS expect error, cloning not allowed @@ -40,7 +40,7 @@ requesting all changes abort: authorization failed [255] - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS serve errors
--- a/tests/test-push-http.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-push-http.t Mon Sep 10 14:08:10 2012 -0700 @@ -17,7 +17,7 @@ > cat hg.pid >> $DAEMON_PIDS > hg --cwd ../test2 push http://localhost:$HGPORT/ > exitstatus=$? - > "$TESTDIR/killdaemons.py" + > "$TESTDIR/killdaemons.py" $DAEMON_PIDS > echo % serve errors > cat errors.log > return $exitstatus
--- a/tests/test-subrepo-relative-path.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-subrepo-relative-path.t Mon Sep 10 14:08:10 2012 -0700 @@ -70,7 +70,7 @@ source ../sub revision 863c1745b441bd97a8c4a096e87793073f4fb215 - $ "$TESTDIR/killdaemons.py" + $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS subrepo paths with ssh urls
--- a/tests/test-treediscovery-legacy.t Tue Aug 28 20:52:04 2012 +0200 +++ b/tests/test-treediscovery-legacy.t Mon Sep 10 14:08:10 2012 -0700 @@ -35,7 +35,7 @@ > cat hg.pid >> $DAEMON_PIDS > } $ tstop() { - > "$TESTDIR/killdaemons.py" + > "$TESTDIR/killdaemons.py" $DAEMON_PIDS > cp $HGRCPATH-withcap $HGRCPATH > }