util: flush stdout before calling external processes
stdout could have content in its buffer while a subprocess ran and emitted
output.
Flushing stdout ensures that output now comes in the right order.
--- a/mercurial/util.py Fri Feb 18 03:34:47 2011 +0100
+++ b/mercurial/util.py Fri Feb 18 03:35:01 2011 +0100
@@ -386,6 +386,10 @@
if out is specified, it is assumed to be a file-like object that has a
write() method. stdout and stderr will be redirected to out.'''
+ try:
+ sys.stdout.flush()
+ except Exception:
+ pass
def py2shell(val):
'convert python object into string that is useful to shell'
if val is None or val is False:
--- a/tests/test-bundle.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-bundle.t Fri Feb 18 03:35:01 2011 +0100
@@ -204,13 +204,13 @@
hg -R bundle://../full.hg verify
$ hg pull bundle://../full.hg
- changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:../full.hg
pulling from bundle://../full.hg
requesting all changes
adding changesets
adding manifests
adding file changes
added 9 changesets with 7 changes to 4 files (+1 heads)
+ changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:../full.hg
(run 'hg heads' to see heads, 'hg merge' to merge)
Rollback empty
@@ -227,13 +227,13 @@
Pull full.hg into empty again (using -R; with hook)
$ hg -R empty pull full.hg
- changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:empty+full.hg
pulling from full.hg
requesting all changes
adding changesets
adding manifests
adding file changes
added 9 changesets with 7 changes to 4 files (+1 heads)
+ changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:empty+full.hg
(run 'hg heads' to see heads, 'hg merge' to merge)
Create partial clones
--- a/tests/test-filebranch.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-filebranch.t Fri Feb 18 03:35:01 2011 +0100
@@ -55,10 +55,10 @@
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg merge -v
- merging for foo
resolving manifests
getting bar
merging foo
+ merging for foo
1 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
--- a/tests/test-hook.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-hook.t Fri Feb 18 03:35:01 2011 +0100
@@ -76,17 +76,17 @@
$ cd ../b
$ hg pull ../a
+ pulling from ../a
+ searching for changes
prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
+ adding changesets
+ adding manifests
+ adding file changes
+ added 3 changesets with 2 changes to 2 files
changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
- pulling from ../a
- searching for changes
- adding changesets
- adding manifests
- adding file changes
- added 3 changesets with 2 changes to 2 files
(run 'hg update' to get a working copy)
tag hooks can see env vars
@@ -176,9 +176,9 @@
$ echo '[hooks]' > .hg/hgrc
$ echo 'prechangegroup.forbid = python "$TESTDIR"/printenv.py prechangegroup.forbid 1' >> .hg/hgrc
$ hg pull ../a
- prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
pulling from ../a
searching for changes
+ prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
abort: prechangegroup.forbid hook exited with status 1
[255]
@@ -189,14 +189,14 @@
$ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
$ echo 'pretxnchangegroup.forbid1 = python "$TESTDIR"/printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc
$ hg pull ../a
- 4:539e4b31b6dc
- pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
pulling from ../a
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ 4:539e4b31b6dc
+ pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
transaction abort!
rollback completed
abort: pretxnchangegroup.forbid1 hook exited with status 1
@@ -211,11 +211,11 @@
$ echo 'preoutgoing = python "$TESTDIR"/printenv.py preoutgoing' >> ../a/.hg/hgrc
$ echo 'outgoing = python "$TESTDIR"/printenv.py outgoing' >> ../a/.hg/hgrc
$ hg pull ../a
- preoutgoing hook: HG_SOURCE=pull
- outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
pulling from ../a
searching for changes
+ preoutgoing hook: HG_SOURCE=pull
adding changesets
+ outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
@@ -227,10 +227,10 @@
$ echo 'preoutgoing.forbid = python "$TESTDIR"/printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc
$ hg pull ../a
+ pulling from ../a
+ searching for changes
preoutgoing hook: HG_SOURCE=pull
preoutgoing.forbid hook: HG_SOURCE=pull
- pulling from ../a
- searching for changes
abort: preoutgoing.forbid hook exited with status 1
[255]
--- a/tests/test-http.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-http.t Fri Feb 18 03:35:01 2011 +0100
@@ -76,12 +76,12 @@
$ echo '[hooks]' >> .hg/hgrc
$ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
$ hg pull
- changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
pulling from http://localhost:$HGPORT1/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
(run 'hg update' to get a working copy)
$ cd ..
--- a/tests/test-https.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-https.t Fri Feb 18 03:35:01 2011 +0100
@@ -134,13 +134,13 @@
$ echo "changegroup = python '$TESTDIR'/printenv.py changegroup" >> .hg/hgrc
$ hg pull
warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
- changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=https://localhost:$HGPORT/
pulling from https://localhost:$HGPORT/
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=https://localhost:$HGPORT/
warning: localhost certificate with fingerprint 91:4f:1a:ff:87:24:9c:09:b6:85:9b:88:b1:90:6d:30:75:64:91:ca not verified (check hostfingerprints or web.cacerts config setting)
(run 'hg update' to get a working copy)
$ cd ..
--- a/tests/test-merge-symlinks.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-merge-symlinks.t Fri Feb 18 03:35:01 2011 +0100
@@ -38,11 +38,11 @@
merge heads
$ hg merge --tool="python ../echo.py"
+ merging l
HG_FILE l
HG_MY_ISLINK 1
HG_OTHER_ISLINK 0
HG_BASE_ISLINK 0
- merging l
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
@@ -54,9 +54,9 @@
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg copy l l2
$ HGMERGE="python ../echo.py" hg up 3
+ merging l2
HG_FILE l2
HG_MY_ISLINK 1
HG_OTHER_ISLINK 0
HG_BASE_ISLINK 0
- merging l2
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-merge-tools.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-merge-tools.t Fri Feb 18 03:35:01 2011 +0100
@@ -219,13 +219,13 @@
true.executable=cat
# hg update -C 1
# hg merge -r 2
+ merging f
revision 1
space
revision 0
space
revision 2
space
- merging f
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
# cat f
@@ -244,13 +244,13 @@
true.executable=cat
# hg update -C 1
# hg merge -r 2 --config merge-tools.true.executable=cat
+ merging f
revision 1
space
revision 0
space
revision 2
space
- merging f
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
# cat f
@@ -598,6 +598,7 @@
true.executable=cat
# hg update -C 1
# hg merge -r 3 --config merge-tools.true.premerge=False
+ merging f
revision 1
space
revision 0
@@ -605,7 +606,6 @@
revision 0
space
revision 3
- merging f
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
# cat f
@@ -631,6 +631,7 @@
# hg update -C 1
$ hg merge -r 2 --config merge-tools.true.executable=head --config merge-tools.true.args='$base $local $other $output' \
> | sed 's,==> .* <==,==> ... <==,g'
+ merging f
==> ... <==
revision 0
space
@@ -646,7 +647,6 @@
==> ... <==
revision 1
space
- merging f
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ aftermerge
@@ -757,13 +757,13 @@
true.executable=cat
# hg update -C 1
# hg merge -y -r 2 --config merge-tools.true.checkchanged=1
+ merging f
revision 1
space
revision 0
space
revision 2
space
- merging f
output file f appears unchanged
was merge successful (yn)? n
merging f failed!
--- a/tests/test-merge1.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-merge1.t Fri Feb 18 03:35:01 2011 +0100
@@ -72,8 +72,8 @@
[255]
merge of b expected
$ hg merge -f 1
+ merging b
merging for b
- merging b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg diff --nodates
@@ -153,8 +153,8 @@
[255]
merge of b expected
$ hg merge -f 2
+ merging b
merging for b
- merging b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg diff --nodates
--- a/tests/test-patchbomb.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-patchbomb.t Fri Feb 18 03:35:01 2011 +0100
@@ -159,12 +159,12 @@
$ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \
> --config extensions.progress= --config progress.assume-tty=1 \
> --config progress.delay=0 --config progress.refresh=0
- \rwriting [ ] 0/3\rwriting [ ] 0/3\r \r\r \r\rwriting [====================> ] 1/3\rwriting [====================> ] 1/3\r \r\r \r\rwriting [==========================================> ] 2/3\rwriting [==========================================> ] 2/3\r \rThis patch series consists of 2 patches. (esc)
+ This patch series consists of 2 patches.
Write the introductory message for the patch series.
-
+ \rwriting [ ] 0/3\rwriting [ ] 0/3\r \r\r \r\rwriting [====================> ] 1/3\rwriting [====================> ] 1/3\r \r\r \r\rwriting [==========================================> ] 2/3\rwriting [==========================================> ] 2/3\r \r (esc)
Writing [PATCH 0 of 2] test ...
Writing [PATCH 1 of 2] a ...
Writing [PATCH 2 of 2] b ...
--- a/tests/test-pull-pull-corruption.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-pull-pull-corruption.t Fri Feb 18 03:35:01 2011 +0100
@@ -42,10 +42,10 @@
... and start another pull before the first one has finished
$ sleep 1
+ pulling from ../source1
+ requesting all changes
$ hg pull ../source2 2>/dev/null
pulling from ../source2
- pulling from ../source1
- requesting all changes
adding changesets
adding manifests
adding file changes
--- a/tests/test-static-http.t Fri Feb 18 03:34:47 2011 +0100
+++ b/tests/test-static-http.t Fri Feb 18 03:35:01 2011 +0100
@@ -68,13 +68,13 @@
$ echo '[hooks]' >> .hg/hgrc
$ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
$ hg pull
- changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote
pulling from static-http://localhost:$HGPORT/remote
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote
(run 'hg update' to get a working copy)
trying to push