2019-05-28 13:12:27 +03:00
|
|
|
$ setconfig extensions.treemanifest=!
|
2018-06-21 05:27:18 +03:00
|
|
|
#require no-fsmonitor
|
|
|
|
|
2013-02-10 01:35:30 +04:00
|
|
|
setup
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
2016-08-23 23:40:08 +03:00
|
|
|
> [alias]
|
2019-06-26 20:59:13 +03:00
|
|
|
> blackbox = blackbox --no-timestamp --no-sid
|
2016-08-23 23:40:08 +03:00
|
|
|
> confuse = log --limit 3
|
2017-09-12 03:07:41 +03:00
|
|
|
> so-confusing = confuse --style compact
|
2013-02-10 01:35:30 +04:00
|
|
|
> EOF
|
2019-03-26 05:22:16 +03:00
|
|
|
$ setconfig tracing.threshold=100000
|
2013-02-10 01:35:30 +04:00
|
|
|
$ hg init blackboxtest
|
|
|
|
$ cd blackboxtest
|
|
|
|
|
|
|
|
command, exit codes, and duration
|
|
|
|
|
|
|
|
$ echo a > a
|
|
|
|
$ hg add a
|
2019-06-26 20:59:13 +03:00
|
|
|
$ hg blackbox --pattern '{"legacy_log":{"service":["or","command","command_finish"]}}'
|
|
|
|
[legacy][command] add a
|
|
|
|
[legacy][command_finish] add a exited 0 after 0.00 seconds
|
|
|
|
[legacy][command] blackbox --pattern '{"legacy_log":{"service":["or","command","command_finish"]}}'
|
2013-02-10 01:35:30 +04:00
|
|
|
|
2016-08-23 23:40:08 +03:00
|
|
|
alias expansion is logged
|
2019-06-26 20:59:13 +03:00
|
|
|
$ rm -rf ./.hg/blackbox*
|
2016-08-23 23:40:08 +03:00
|
|
|
$ hg confuse
|
2019-07-20 11:01:33 +03:00
|
|
|
$ hg blackbox
|
2019-09-21 03:43:59 +03:00
|
|
|
[command] ["hg", "confuse"] started by uid 0 as pid 0 with nice 0
|
2019-09-21 03:43:59 +03:00
|
|
|
[process_tree] (this process)
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][env_vars]
|
2019-06-26 20:59:13 +03:00
|
|
|
[legacy][command] confuse
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][dirstate_info]
|
|
|
|
[legacy][jobid]
|
|
|
|
[legacy][dirstate_info]
|
2019-06-26 20:59:13 +03:00
|
|
|
[legacy][command_finish] confuse exited 0 after 0.00 seconds
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][command_info]
|
2019-09-21 03:43:59 +03:00
|
|
|
[commmand_finish] exited 0 in 0 ms, max RSS: 0 bytes
|
2019-09-21 03:43:59 +03:00
|
|
|
[command] ["hg", "blackbox"] started by uid 0 as pid 0 with nice 0
|
2019-09-21 03:43:59 +03:00
|
|
|
[process_tree] (this process)
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][env_vars]
|
|
|
|
[legacy][command] blackbox
|
|
|
|
[legacy][dirstate_info]
|
|
|
|
[legacy][jobid]
|
2016-08-23 23:40:08 +03:00
|
|
|
|
2017-09-12 03:07:41 +03:00
|
|
|
recursive aliases work correctly
|
2019-06-26 20:59:13 +03:00
|
|
|
$ rm -rf ./.hg/blackbox*
|
2017-09-12 03:07:41 +03:00
|
|
|
$ hg so-confusing
|
2019-07-20 11:01:33 +03:00
|
|
|
$ hg blackbox
|
2019-09-21 03:43:59 +03:00
|
|
|
[command] ["hg", "so-confusing"] started by uid 0 as pid 0 with nice 0
|
2019-09-21 03:43:59 +03:00
|
|
|
[process_tree] (this process)
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][env_vars]
|
2019-06-26 20:59:13 +03:00
|
|
|
[legacy][command] so-confusing
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][dirstate_info]
|
|
|
|
[legacy][jobid]
|
|
|
|
[legacy][dirstate_info]
|
2019-06-26 20:59:13 +03:00
|
|
|
[legacy][command_finish] so-confusing exited 0 after 0.00 seconds
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][command_info]
|
2019-09-21 03:43:59 +03:00
|
|
|
[commmand_finish] exited 0 in 0 ms, max RSS: 0 bytes
|
2019-09-21 03:43:59 +03:00
|
|
|
[command] ["hg", "blackbox"] started by uid 0 as pid 0 with nice 0
|
2019-09-21 03:43:59 +03:00
|
|
|
[process_tree] (this process)
|
2019-07-20 11:01:33 +03:00
|
|
|
[legacy][env_vars]
|
|
|
|
[legacy][command] blackbox
|
|
|
|
[legacy][dirstate_info]
|
|
|
|
[legacy][jobid]
|
2017-09-12 03:07:41 +03:00
|
|
|
|
2013-02-10 01:35:30 +04:00
|
|
|
incoming change tracking
|
|
|
|
|
2013-02-13 23:07:01 +04:00
|
|
|
create two heads to verify that we only see one change in the log later
|
|
|
|
$ hg commit -ma
|
|
|
|
$ hg up null
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ echo b > b
|
|
|
|
$ hg commit -Amb
|
|
|
|
adding b
|
|
|
|
|
|
|
|
clone, commit, pull
|
2013-02-10 01:35:30 +04:00
|
|
|
$ hg clone . ../blackboxtest2
|
|
|
|
updating to branch default
|
2013-02-13 23:07:01 +04:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo c > c
|
|
|
|
$ hg commit -Amc
|
|
|
|
adding c
|
2013-02-10 01:35:30 +04:00
|
|
|
$ cd ../blackboxtest2
|
|
|
|
$ hg pull
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/blackboxtest
|
2013-02-13 23:07:01 +04:00
|
|
|
searching for changes
|
2013-02-10 01:35:30 +04:00
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets d02f48003e62
|
2019-06-26 20:59:13 +03:00
|
|
|
$ hg blackbox --pattern '{"legacy_log":{"service":["or","command","command_finish","command_alias"]}}'
|
|
|
|
[legacy][command] pull
|
|
|
|
[legacy][command_finish] pull exited 0 after 0.00 seconds
|
|
|
|
[legacy][command] blackbox --pattern '{"legacy_log":{"service":["or","command","command_finish","command_alias"]}}'
|
2013-02-10 01:35:30 +04:00
|
|
|
|
2013-03-21 00:40:05 +04:00
|
|
|
we must not cause a failure if we cannot write to the log
|
|
|
|
|
|
|
|
$ hg rollback
|
|
|
|
repository tip rolled back to revision 1 (undo pull)
|
2013-04-23 05:00:59 +04:00
|
|
|
|
2019-06-26 20:59:13 +03:00
|
|
|
$ rm -rf .hg/blackbox*
|
|
|
|
$ mkdir -p .hg/blackbox
|
|
|
|
$ touch .hg/blackbox/v1
|
2013-03-21 00:40:05 +04:00
|
|
|
$ hg --debug incoming
|
2017-12-11 06:50:57 +03:00
|
|
|
comparing with $TESTTMP/blackboxtest
|
2013-03-21 00:40:05 +04:00
|
|
|
query 1; heads
|
|
|
|
searching for changes
|
|
|
|
all local heads known remotely
|
|
|
|
changeset: 2:d02f48003e62c24e2659d97d30f2a83abe5d5d51
|
|
|
|
tag: tip
|
|
|
|
phase: draft
|
|
|
|
parent: 1:6563da9dcf87b1949716e38ff3e3dfaa3198eb06
|
|
|
|
parent: -1:0000000000000000000000000000000000000000
|
2019-05-22 18:28:07 +03:00
|
|
|
manifest: ab9d46b053ebf45b7996f2922b9893ff4b63d892
|
2013-03-21 00:40:05 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
files+: c
|
|
|
|
extra: branch=default
|
|
|
|
description:
|
|
|
|
c
|
|
|
|
|
|
|
|
|
|
|
|
$ hg pull
|
2017-12-11 06:50:57 +03:00
|
|
|
pulling from $TESTTMP/blackboxtest
|
2013-03-21 00:40:05 +04:00
|
|
|
searching for changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets d02f48003e62
|
2013-03-21 00:40:05 +04:00
|
|
|
|
2019-06-26 20:59:13 +03:00
|
|
|
$ rm .hg/blackbox/v1
|
2013-03-13 21:43:51 +04:00
|
|
|
|
2013-02-13 23:07:01 +04:00
|
|
|
extension and python hooks - use the eol extension for a pythonhook
|
|
|
|
|
|
|
|
$ echo '[extensions]' >> .hg/hgrc
|
|
|
|
$ echo 'eol=' >> .hg/hgrc
|
|
|
|
$ echo '[hooks]' >> .hg/hgrc
|
|
|
|
$ echo 'update = echo hooked' >> .hg/hgrc
|
|
|
|
$ hg update
|
2017-07-12 21:17:58 +03:00
|
|
|
The fsmonitor extension is incompatible with the eol extension and has been disabled. (fsmonitor !)
|
2015-08-12 02:26:12 +03:00
|
|
|
hooked
|
merge: make in-memory changes visible to external update hooks
c67339617276 (while 3.4 code-freeze) made all 'update' hooks run after
releasing wlock for visibility of in-memory dirstate changes. But this
breaks paired invocation of 'preupdate' and 'update' hooks.
For example, 'hg backout --merge' for TARGET revision, which isn't
parent of CURRENT, consists of steps below:
1. update from CURRENT to TARGET
2. commit BACKOUT revision, which backs TARGET out
3. update from BACKOUT to CURRENT
4. merge TARGET into CURRENT
Then, we expects hooks to run in the order below:
- 'preupdate' on CURRENT for (1)
- 'update' on TARGET for (1)
- 'preupdate' on BACKOUT for (3)
- 'update' on CURRENT for (3)
- 'preupdate' on TARGET for (4)
- 'update' on CURRENT/TARGET for (4)
But hooks actually run in the order below:
- 'preupdate' on CURRENT for (1)
- 'preupdate' on BACKOUT for (3)
- 'preupdate' on TARGET for (4)
- 'update' on TARGET for (1), but actually on CURRENT/TARGET
- 'update' on CURRENT for (3), but actually on CURRENT/TARGET
- 'update' on CURRENT for (4), but actually on CURRENT/TARGET
Root cause of the issue focused by c67339617276 is that external
'update' hook process can't view in-memory changes (especially, of
dirstate), because they aren't written out until the end of
transaction (or wlock).
Now, hooks can be invoked just after updating, because previous
patches made in-memory changes visible to external process.
This patch may break backward compatibility from the point of view of
"scheduling hook execution", but should be reasonable because 'update'
hooks had been executed in this order before 3.4.
This patch tests "hg backout" and "hg unshelve", because the former
activates the transaction before 'update' hook invocation, but the
former doesn't.
2015-10-16 19:15:34 +03:00
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2017-06-06 19:47:39 +03:00
|
|
|
updated to "d02f48003e62: c"
|
2016-02-02 17:49:02 +03:00
|
|
|
1 other heads for branch "default"
|
2017-07-12 21:17:58 +03:00
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> # disable eol, because it is not needed for subsequent tests
|
|
|
|
> # (in addition, keeping it requires extra care for fsmonitor)
|
|
|
|
> eol=!
|
|
|
|
> EOF
|
2019-07-06 12:41:45 +03:00
|
|
|
$ hg blackbox --pattern '{"blocked":{"op":["or","pythonhook","exthook"]}}'
|
|
|
|
[blocked] PythonHook (preupdate.eol) blocked for 0 ms
|
2019-07-06 12:41:45 +03:00
|
|
|
[blocked] ExtHook (update) blocked for 0 ms
|
2017-09-07 05:27:30 +03:00
|
|
|
|
2019-06-26 20:59:13 +03:00
|
|
|
log rotation (tested in the Rust land)
|
2017-09-07 05:27:30 +03:00
|
|
|
|
2018-04-17 06:42:00 +03:00
|
|
|
blackbox does not crash with empty log message
|
|
|
|
|
|
|
|
$ newrepo
|
|
|
|
$ cat > $TESTTMP/uilog.py << EOF
|
|
|
|
> from __future__ import absolute_import
|
2019-05-28 12:35:16 +03:00
|
|
|
> from edenscm.mercurial import registrar, scmutil, util
|
2018-04-17 06:42:00 +03:00
|
|
|
> cmdtable = {}
|
|
|
|
> command = registrar.command(cmdtable)
|
|
|
|
> @command('uilog')
|
2019-05-28 12:35:16 +03:00
|
|
|
> def uilogcmd(ui, repo, category, *args):
|
2018-04-17 06:42:00 +03:00
|
|
|
> args = [a.replace('-NEWLINE', '\n') for a in args]
|
|
|
|
> ui.log(category, *args)
|
2019-05-28 12:35:16 +03:00
|
|
|
> @command('utillog')
|
|
|
|
> def utillogcmd(ui, repo, category, *args):
|
|
|
|
> util.log(category, *args)
|
2018-04-17 06:42:00 +03:00
|
|
|
> EOF
|
|
|
|
$ setconfig extensions.uilog=$TESTTMP/uilog.py
|
|
|
|
$ setconfig blackbox.track=foo
|
|
|
|
$ hg uilog foo
|
|
|
|
$ hg uilog foo ''
|
|
|
|
|
2018-04-17 06:42:02 +03:00
|
|
|
blackbox adds "\n" automatically
|
|
|
|
|
|
|
|
$ setconfig blackbox.track=bar
|
|
|
|
$ hg uilog bar bar1-NEWLINE
|
|
|
|
$ hg uilog bar bar2
|
|
|
|
$ hg uilog bar bar3
|
2019-06-26 20:59:13 +03:00
|
|
|
$ hg blackbox --pattern '{"legacy_log":{"service":"bar"}}'
|
|
|
|
[legacy][bar] bar1
|
|
|
|
[legacy][bar] bar2
|
|
|
|
[legacy][bar] bar3
|
2018-04-17 06:42:02 +03:00
|
|
|
|
2019-05-28 12:35:16 +03:00
|
|
|
blackbox can log without a ui object using util.log
|
|
|
|
|
|
|
|
$ setconfig blackbox.track=withoutui
|
|
|
|
$ hg utillog withoutui "this log is without a ui"
|
2019-06-26 20:59:13 +03:00
|
|
|
$ hg blackbox --pattern '{"legacy_log":{"service":"withoutui"}}'
|
|
|
|
[legacy][withoutui] this log is without a ui
|
2019-05-28 12:35:16 +03:00
|
|
|
|
2018-05-18 19:56:37 +03:00
|
|
|
blackbox writes Request ID if HGREQUESTID is set
|
2019-06-26 20:59:13 +03:00
|
|
|
(This is not implemented in the new blackbox. Maybe it is not that important nowadays?)
|
2018-06-12 03:27:20 +03:00
|
|
|
|
|
|
|
blackbox should not fail with "TypeError: not enough arguments for format string"
|
|
|
|
|
2019-06-26 20:59:13 +03:00
|
|
|
$ rm -rf ./.hg/blackbox*
|
2018-06-12 03:27:20 +03:00
|
|
|
$ hg debugshell --command "ui.log('foo', 'ba' + 'r %s %r')"
|
|
|
|
$ hg debugshell --command "ui.log('foo', 'ba' + 'r %s %r', 'arg1')"
|
2019-06-26 20:59:13 +03:00
|
|
|
$ hg blackbox --pattern '{"legacy_log":{"service":"foo"}}'
|
|
|
|
[legacy][foo] bar %s %r
|
|
|
|
[legacy][foo] bar %s %r arg1
|
2018-06-12 03:27:20 +03:00
|
|
|
|