##// END OF EJS Templates
chainsaw-update: log actual locks breaking...
chainsaw-update: log actual locks breaking Previously, the command would simply state that it was about to break locks, not if there was actually some to break. This version is race-free. It would be also possible to display the content of the lock before hand (not race-free but informative in almost all cases).

File last commit:

r52324:fe68a2dc default
r52324:fe68a2dc default
Show More
test-chainsaw-update.t
111 lines | 2.8 KiB | text/troff | Tads3Lexer
/ tests / test-chainsaw-update.t
============================================
Tests for the admin::chainsaw-update command
============================================
setup
=====
$ cat >> $HGRCPATH << EOF
> [extensions]
> chainsaw=
> EOF
$ hg init src
$ cd src
$ echo 1 > foo
$ hg ci -Am1
adding foo
$ cd ..
Actual tests
============
Simple invocation
-----------------
$ hg init repo
$ cd repo
$ hg admin::chainsaw-update --rev default --source ../src
recovering after interrupted transaction, if any
no interrupted transaction available
pulling from ../src
updating to revision 'default'
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done
$ cat foo
1
Test lock breacking capabilities
--------------------------------
Demonstrate lock-breaking capabilities with locks that regular Mercurial
operation would not break, because the hostnames registered in locks differ
from the current hostname (happens a lot with succesive containers):
$ ln -s invalid.host.test/effffffc:171814 .hg/store/lock
$ ln -s invalid.host.test/effffffc:171814 .hg/wlock
$ hg debuglock
lock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re)
wlock: (.*?), process 171814, host invalid.host.test/effffffc \((\d+)s\) (re)
[2]
$ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src
had to break store lock
had to break working copy lock
recovering after interrupted transaction, if any
no interrupted transaction available
pulling from ../src
updating to revision 'default'
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
chainsaw-update to revision 'default' for repository at '$TESTTMP/repo' done
Test file purging capabilities
------------------------------
Let's also add local modifications (tracked and untracked) to demonstrate the
purging.
$ echo untracked > bar
$ echo modified > foo
$ hg status -A
M foo
? bar
$ echo 2 > ../src/foo
$ hg -R ../src commit -m2
$ hg admin::chainsaw-update --rev default --source ../src -q
no interrupted transaction available
$ hg status -A
C foo
$ cat foo
2
Now behaviour with respect to ignored files: they are not purged if
the --no-purge-ignored flag is passed, but they are purged by default
$ echo bar > .hgignore
$ hg ci -Aqm hgignore
$ echo ignored > bar
$ hg status --all
I bar
C .hgignore
C foo
$ hg admin::chainsaw-update --no-purge-ignored --rev default --source ../src -q
no interrupted transaction available
$ hg status --all
I bar
C .hgignore
C foo
$ cat bar
ignored
$ hg admin::chainsaw-update --rev default --source ../src -q
no interrupted transaction available
$ hg status --all
C .hgignore
C foo
$ test -f bar
[1]