##// END OF EJS Templates
identify: add template support...
identify: add template support This is based on a patch proposed last year by Mathias De Maré[1], with a few changes. - Tags and bookmarks are now formatted lists, for more flexible queries. - The templater is populated whether or not [-nibtB] is specified. (Plain output is unchanged.) This seems more consistent with other templated commands. - The 'id' property is a string, instead of a list. - The parents of 'wdir()' have their own list of attributes. I left 'id' as a string because it seems very useful for generating version info. It's also a bit strange because the value and meaning changes depending on whether or not --debug is passed (short vs full hash), whether the revision is a merge or not (one hash or two, separated by a '+'), the working directory or not (node vs p1node), and local or not (remote defaults to tip, and never has '+'). The equivalent string built with {rev} seems much less useful, and I couldn't think of a reasonable name, so I left it out. The discussion seemed to be pointing towards having a list of nodes, with more than one entry for a merge. It seems simpler to give the nodes a name, and use {node} for the actual commit probed, especially now that there is a virtual node for 'wdir()'. Yuya mentioned using fm.nested() in that thread, so I did for the parent nodes. I'm not sure if the plan is to fill in all of the context attributes in these items, or if these nested items should simply be made {p1node} and {p1rev}. I used ':' as the tag separator for consistency with {tags} in the log templater. Likewise, bookmarks are separated by a space for consistency with the corresponding log template. [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-August/087039.html

File last commit:

r32337:46ba2cdd default
r33051:15a79ac8 default
Show More
test-lock-badness.t
78 lines | 2.0 KiB | text/troff | Tads3Lexer
/ tests / test-lock-badness.t
Matt Mackall
tests: change some #ifs to #requires
r22047 #require unix-permissions no-root no-windows
Mads Kiilerich
localrepo: give a sigh of relief when getting lock after waiting for it...
r20380
Prepare
Adrian Buehlmann
tests: unify test-lock-badness
r12071 $ hg init a
$ echo a > a/a
$ hg -R a ci -A -m a
adding a
$ hg clone a b
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
Siddharth Agarwal
lock: while releasing, unlink lockfile even if the release function throws...
r23032 Test that raising an exception in the release function doesn't cause the lock to choke
$ cat > testlock.py << EOF
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > from mercurial import error, registrar
Siddharth Agarwal
lock: while releasing, unlink lockfile even if the release function throws...
r23032 >
> cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > command = registrar.command(cmdtable)
Siddharth Agarwal
lock: while releasing, unlink lockfile even if the release function throws...
r23032 >
> def acquiretestlock(repo, releaseexc):
> def unlock():
> if releaseexc:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > raise error.Abort('expected release exception')
Siddharth Agarwal
lock: while releasing, unlink lockfile even if the release function throws...
r23032 > l = repo._lock(repo.vfs, 'testlock', False, unlock, None, 'test lock')
> return l
>
> @command('testlockexc')
> def testlockexc(ui, repo):
> testlock = acquiretestlock(repo, True)
> try:
> testlock.release()
> finally:
> try:
> testlock = acquiretestlock(repo, False)
> except error.LockHeld:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 > raise error.Abort('lockfile on disk even after releasing!')
Siddharth Agarwal
lock: while releasing, unlink lockfile even if the release function throws...
r23032 > testlock.release()
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> testlock=$TESTTMP/testlock.py
> EOF
$ hg -R b testlockexc
abort: expected release exception
[255]
Mads Kiilerich
localrepo: give a sigh of relief when getting lock after waiting for it...
r20380 One process waiting for another
$ cat > hooks.py << EOF
> import time
> def sleepone(**x): time.sleep(1)
> def sleephalf(**x): time.sleep(0.5)
> EOF
Adrian Buehlmann
tests: unify test-lock-badness
r12071 $ echo b > b/b
Mads Kiilerich
localrepo: give a sigh of relief when getting lock after waiting for it...
r20380 $ hg -R b ci -A -m b --config hooks.precommit="python:`pwd`/hooks.py:sleepone" > stdout &
timeless
tests: test-lock-badness.t message could come later...
r29008 $ hg -R b up -q --config hooks.pre-update="python:`pwd`/hooks.py:sleephalf" \
> > preup 2>&1
$ wait
$ cat preup
Mark Ignacio
lock: show more detail for new-style locks in lock waiting message (issue4752)...
r29883 waiting for lock on working directory of b held by process '*' on host '*' (glob)
timeless
tests: test-lock-badness.t message could come later...
r29008 got lock after * seconds (glob)
Mads Kiilerich
localrepo: give a sigh of relief when getting lock after waiting for it...
r20380 $ cat stdout
Adrian Buehlmann
tests: unify test-lock-badness
r12071 adding b
Mads Kiilerich
localrepo: give a sigh of relief when getting lock after waiting for it...
r20380 Pushing to a local read-only repo that can't be locked
Adrian Buehlmann
tests: unify test-lock-badness
r12071 $ chmod 100 a/.hg/store
$ hg -R b push a
pushing to a
Pierre-Yves David
localrepo: add unbundle support...
r20969 searching for changes
Adrian Buehlmann
tests: unify test-lock-badness
r12071 abort: could not lock repository a: Permission denied
Matt Mackall
tests: add exit codes to unified tests
r12316 [255]
Adrian Buehlmann
tests: unify test-lock-badness
r12071
$ chmod 700 a/.hg/store