Mercurial > hg > evolve
changeset 1859:6d54fd20bb81 mercurial-3.4
merge with latest fix
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Sat, 29 Oct 2016 15:07:27 +0200 |
parents | bc590681de77 (diff) ad04f3c3b1a9 (current diff) |
children | 1554b30b18eb |
files | tests/test-evolve.t tests/test-obsolete.t tests/test-stabilize-result.t tests/test-tutorial.t tests/test-uncommit.t |
diffstat | 16 files changed, 207 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
new file mode 100755 --- /dev/null +++ b/tests/dummyssh @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import sys +import os + +os.chdir(os.getenv('TESTTMP')) + +if sys.argv[1] != "user@dummy": + sys.exit(-1) + +os.environ["SSH_CLIENT"] = "127.0.0.1 1 2" + +log = open("dummylog", "ab") +log.write("Got arguments") +for i, arg in enumerate(sys.argv[1:]): + log.write(" %d:%s" % (i + 1, arg)) +log.write("\n") +log.close() +hgcmd = sys.argv[2] +if os.name == 'nt': + # hack to make simple unix single quote quoting work on windows + hgcmd = hgcmd.replace("'", '"') +r = os.system(hgcmd) +sys.exit(bool(r))
new file mode 100755 --- /dev/null +++ b/tests/killdaemons.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +import os, sys, time, errno, signal + +if os.name =='nt': + import ctypes + + def _check(ret, expectederr=None): + if ret == 0: + winerrno = ctypes.GetLastError() + if winerrno == expectederr: + return True + raise ctypes.WinError(winerrno) + + def kill(pid, logfn, tryhard=True): + logfn('# Killing daemon process %d' % pid) + PROCESS_TERMINATE = 1 + PROCESS_QUERY_INFORMATION = 0x400 + SYNCHRONIZE = 0x00100000 + WAIT_OBJECT_0 = 0 + WAIT_TIMEOUT = 258 + handle = ctypes.windll.kernel32.OpenProcess( + PROCESS_TERMINATE|SYNCHRONIZE|PROCESS_QUERY_INFORMATION, + False, pid) + if handle == 0: + _check(0, 87) # err 87 when process not found + return # process not found, already finished + try: + r = ctypes.windll.kernel32.WaitForSingleObject(handle, 100) + if r == WAIT_OBJECT_0: + pass # terminated, but process handle still available + elif r == WAIT_TIMEOUT: + _check(ctypes.windll.kernel32.TerminateProcess(handle, -1)) + else: + _check(r) + + # TODO?: forcefully kill when timeout + # and ?shorter waiting time? when tryhard==True + r = ctypes.windll.kernel32.WaitForSingleObject(handle, 100) + # timeout = 100 ms + if r == WAIT_OBJECT_0: + pass # process is terminated + elif r == WAIT_TIMEOUT: + logfn('# Daemon process %d is stuck') + else: + _check(r) # any error + except: #re-raises + ctypes.windll.kernel32.CloseHandle(handle) # no _check, keep error + raise + _check(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) + 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 + +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/test-amend.t +++ b/tests/test-amend.t @@ -115,7 +115,6 @@ branch: foo commit: 1 unknown (clean) update: (current) - phases: 3 draft Check the help $ hg amend -h
--- a/tests/test-corrupt.t +++ b/tests/test-corrupt.t @@ -110,7 +110,8 @@ adding manifests adding file changes added 1 changesets with 2 changes to 2 files - 2 new obsolescence markers + pushing 2 obsolescence markers (16? bytes) (glob) + 2 obsolescence markers added $ hg -R ../other verify checking changesets checking manifests
--- a/tests/test-divergent.t +++ b/tests/test-divergent.t @@ -99,14 +99,18 @@ |/ o 0:135f39f4bd78@default(draft) add _a [] - $ hg evolve --all --any --divergent - merge:[7] add cdivergent1 - with: [8] cdivergent2 - base: [6] add _c - updating to "local" conflict - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - working directory is now at 6602ff5a79dc +## Fixed only for 3.5+ +# +# $ hg evolve --all --any --divergent +# merge:[7] add cdivergent1 +# with: [8] cdivergent2 +# base: [6] add _c +# updating to "local" conflict +# 0 files updated, 0 files merged, 0 files removed, 0 files unresolved +# 0 files updated, 0 files merged, 0 files removed, 0 files unresolved +# working directory is now at 6602ff5a79dc + + $ cd .. Test None docstring issue of evolve divergent, which caused hg crush
--- a/tests/test-evolve-bumped.t +++ b/tests/test-evolve-bumped.t @@ -49,6 +49,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers (run 'hg update' to get a working copy) $ hg log -r 'draft()' 1:4d1169d82e47@default(draft) modify a @@ -67,6 +68,7 @@ pulling from ../public searching for changes no changes found + pull obsolescence markers 1 new bumped changesets $ hg evolve -a -A --bumped
--- a/tests/test-evolve.t +++ b/tests/test-evolve.t @@ -475,6 +475,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers $ cd alpha $ cat << EOF > A @@ -531,7 +532,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 2 new obsolescence markers + pull obsolescence markers + 2 obsolescence markers added (run 'hg update' to get a working copy) $ hg up 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -184,7 +184,8 @@ adding manifests adding file changes added 5 changesets with 5 changes to 5 files (+1 heads) - 2 new obsolescence markers + pushing 2 obsolescence markers (13? bytes) (glob) + 2 obsolescence markers added $ hg -R ../other-new verify checking changesets checking manifests @@ -238,7 +239,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 1 new obsolescence markers + pushing 3 obsolescence markers (19? bytes) (glob) + 1 obsolescence markers added $ qlog -R ../other-new 5 - 95de7fc6918d @@ -260,6 +262,8 @@ pushing to ../other-new searching for changes no changes found + pushing 3 obsolescence markers (19? bytes) (glob) + 0 obsolescence markers added [1] $ hg up --hidden -q .^ # 3 @@ -275,8 +279,9 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - 1 new obsolescence markers - (run 'hg heads .' to see heads, 'hg merge' to merge) + pull obsolescence markers + 1 obsolescence markers added + (run 'hg heads' to see heads, 'hg merge' to merge) $ qlog -R ../other-new 6 - 909a0fb57e5d @@ -365,8 +370,9 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - 1 new obsolescence markers - (run 'hg heads .' to see heads, 'hg merge' to merge) + pull obsolescence markers + 1 obsolescence markers added + (run 'hg heads' to see heads, 'hg merge' to merge) $ hg up -q 7 # to check rollback update behavior $ qlog @@ -389,7 +395,6 @@ branch: default commit: 1 deleted, 2 unknown (clean) update: 2 new changesets, 2 branch heads (merge) - phases: 4 draft unstable: 1 changesets $ qlog 6 @@ -539,7 +544,8 @@ adding manifests adding file changes added 2 changesets with 1 changes to [12] files (re) - 3 new obsolescence markers + pushing 7 obsolescence markers (4?? bytes) (glob) + 3 obsolescence markers added $ hg up -q 10 $ mkcommit "obsol_d'''" created new head @@ -551,7 +557,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 1 new obsolescence markers + pushing 8 obsolescence markers (55? bytes) (glob) + 1 obsolescence markers added $ cd .. check bumped detection @@ -663,7 +670,6 @@ branch: default commit: (clean) update: (2|9|11) new changesets, (3|9|10) branch heads \(merge\) (re) - phases: 3 draft bumped: 1 changesets $ hg debugobsolete `getid a7a6f2b5d8a5` `getid 50f11e5e3a63` $ hg log -r 'divergent()'
--- a/tests/test-sharing.t +++ b/tests/test-sharing.t @@ -46,6 +46,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Let's commit a preliminary change and push it to ``test-repo`` for @@ -87,7 +88,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers + pull obsolescence markers + 2 obsolescence markers added 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Figure SG03 @@ -138,7 +140,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 4 new obsolescence markers + pushing 4 obsolescence markers (36? bytes) (glob) + 4 obsolescence markers added Now that the fix is public, we cannot amend it any more. $ hg amend -m 'fix bug 37' @@ -158,6 +161,8 @@ pushing to ../dev-repo searching for changes no changes found + pushing 4 obsolescence markers (36? bytes) (glob) + 0 obsolescence markers added [1] $ hg -R ../dev-repo shortlog -r 'draft()' @@ -191,6 +196,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pushing 4 obsolescence markers (36? bytes) (glob) + 0 obsolescence markers added exporting bookmark bug15 $ hg -R ../review bookmarks bug15 2:f91e97234c2b @@ -206,7 +213,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers + pushing 6 obsolescence markers (55? bytes) (glob) + 2 obsolescence markers added updating bookmark bug15 $ hg -R ../review bookmarks bug15 3:cbdfbd5a5db2 @@ -233,6 +241,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + pushing 4 obsolescence markers (36? bytes) (glob) + 0 obsolescence markers added exporting bookmark featureX $ hg -R ../review bookmarks bug15 3:cbdfbd5a5db2 @@ -249,7 +259,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers + pushing 6 obsolescence markers (5?? bytes) (glob) + 2 obsolescence markers added updating bookmark featureX Bob receives second review, amends, and pushes to public: @@ -263,7 +274,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 4 new obsolescence markers + pushing 8 obsolescence markers (73? bytes) (glob) + 4 obsolescence markers added $ hg -R ../public bookmarks no bookmarks set $ hg push ../review @@ -274,7 +286,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers + pushing 8 obsolescence markers (73? bytes) (glob) + 2 obsolescence markers added updating bookmark featureX $ hg -R ../review bookmarks bug15 3:cbdfbd5a5db2 @@ -344,7 +357,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 4 new obsolescence markers + pull obsolescence markers + 4 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) $ hg log -G -q -r 'head()' o 5:540ba8f317e6 @@ -374,7 +388,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 3 new obsolescence markers + pushing 11 obsolescence markers (* bytes) (glob) + 3 obsolescence markers added $ hg push ../review pushing to ../review searching for changes @@ -382,7 +397,8 @@ adding manifests adding file changes added 1 changesets with 0 changes to 1 files - 1 new obsolescence markers + pushing 11 obsolescence markers (* bytes) (glob) + 1 obsolescence markers added updating bookmark bug15 Figure SG08: review and public changesets after Alice pushes. @@ -444,6 +460,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers + 0 obsolescence markers added 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo 'better fix (alice)' >> file1 $ hg amend -u alice -m 'fix bug 24 (v2 by alice)' @@ -471,7 +489,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 2 new obsolescence markers + pull obsolescence markers + 2 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) 2 new divergent changesets
--- a/tests/test-simple4server-bundle2.t +++ b/tests/test-simple4server-bundle2.t @@ -140,7 +140,7 @@ $ echo '[__temporary__]' >> server/.hg/hgrc $ echo 'advertiseobsolete=False' >> server/.hg/hgrc - $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + $ $TESTDIR/killdaemons.py $DAEMON_PIDS $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS @@ -150,7 +150,7 @@ phases $ echo 'advertiseobsolete=True' >> server/.hg/hgrc - $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + $ $TESTDIR/killdaemons.py $DAEMON_PIDS $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS
--- a/tests/test-simple4server.t +++ b/tests/test-simple4server.t @@ -145,7 +145,7 @@ $ echo '[__temporary__]' >> server/.hg/hgrc $ echo 'advertiseobsolete=False' >> server/.hg/hgrc - $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + $ $TESTDIR/killdaemons.py $DAEMON_PIDS $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS @@ -159,7 +159,7 @@ [1] $ echo 'advertiseobsolete=True' >> server/.hg/hgrc - $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS + $ $TESTDIR/killdaemons.py $DAEMON_PIDS $ hg serve -R server -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log $ cat hg.pid >> $DAEMON_PIDS
--- a/tests/test-stabilize-result.t +++ b/tests/test-stabilize-result.t @@ -307,7 +307,6 @@ branch: default commit: (clean) update: 2 new changesets, 2 branch heads (merge) - phases: 3 draft $ hg export . # HG changeset patch # User test
--- a/tests/test-tutorial.t +++ b/tests/test-tutorial.t @@ -224,6 +224,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + pull obsolescence markers (run 'hg heads' to see heads, 'hg merge' to merge) I now have a new heads. Note that this remote head is immutable @@ -405,7 +406,8 @@ adding manifests adding file changes added 3 changesets with 3 changes to 1 files - 6 new obsolescence markers + pushing 6 obsolescence markers (52? bytes) (glob) + 6 obsolescence markers added for simplicity sake we get the bathroom change in line again @@ -525,7 +527,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 1 new obsolescence markers + pull obsolescence markers + 1 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 75954b8cd933 (public): bathroom stuff @@ -582,7 +585,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 1 new obsolescence markers + pull obsolescence markers + 1 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 75954b8cd933 (draft): bathroom stuff @@ -642,6 +646,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) + pull obsolescence markers + 0 obsolescence markers added (run 'hg heads' to see heads, 'hg merge' to merge) 1 new unstable changesets @@ -731,7 +737,8 @@ adding manifests adding file changes added 2 changesets with 2 changes to 1 files (+1 heads) - 3 new obsolescence markers + pushing 10 obsolescence markers (87? bytes) (glob) + 3 obsolescence markers added remote get a warning that current working directory is based on an obsolete changeset @@ -740,6 +747,8 @@ pulling from $TESTTMP/local (glob) searching for changes no changes found + pull obsolescence markers + 0 obsolescence markers added working directory parent is obsolete! (use 'hg evolve' to update to its successor) @@ -772,6 +781,8 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files + pull obsolescence markers + 0 obsolescence markers added (run 'hg update' to get a working copy) $ hg log -G o 99f039c5ec9e (draft): SPAM SPAM SPAM
--- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -138,6 +138,7 @@ $ hg branch foo marked working directory as branch foo + (branches are permanent and global, did you want a bookmark?) $ hg mv ff f $ hg mv h i $ hg rm j
--- a/tests/test-wireproto-bundle1.t +++ b/tests/test-wireproto-bundle1.t @@ -3,7 +3,7 @@ > [defaults] > amend=-d "0 0" > [ui] - > ssh=python "$RUNTESTDIR/dummyssh" + > ssh=python "$TESTDIR/dummyssh" > [phases] > publish = False > [extensions] @@ -50,6 +50,7 @@ adding manifests adding file changes added 2 changesets with 2 changes to 2 files + pull obsolescence markers (run 'hg update' to get a working copy) $ hg push -R ../other pushing to ssh://user@dummy/server @@ -69,7 +70,8 @@ remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files (+1 heads) - remote: 2 new obsolescence markers + pushing 2 obsolescence markers (18? bytes) (glob) + remote: 2 obsolescence markers added $ hg push pushing to ssh://user@dummy/server searching for changes @@ -86,8 +88,9 @@ adding manifests adding file changes added 1 changesets with 1 changes to [12] files \(\+1 heads\) (re) - 2 new obsolescence markers - (run 'hg heads' to see heads, 'hg merge' to merge) + pull obsolescence markers + 2 obsolescence markers added + (run 'hg heads' to see heads) $ hg -R ../other pull pulling from ssh://user@dummy/server searching for changes