##// END OF EJS Templates
inotify: server: new data structure to keep track of changes....
inotify: server: new data structure to keep track of changes. == Rationale for the new structure == Current structure was a dictionary tree. One directory was tracked as a dictionary: - keys: file/subdir name - values: - for a file, the status (a/r/m/...) - for a subdir, the directory representing the subdir It allowed efficient lookups, no matter of the type of the terminal leaf: for part in path.split('/'): tree = tree[part] However, there is no way to represent a directory and a file with the same name because keys are conflicting in the dictionary. Concrete example: Initial state: root dir |- foo (file) |- bar (file) # data state is: {'foo': 'n', 'bar': 'n'} Remove foo: root dir |- bar (file) # Data becomes {'foo': 'r'} until next commit. Add foo, as a directory, and foo/barbar file: root dir |- bar (file) |-> foo (dir) |- barbar (file) # New state should be represented as: {'foo': {'barbar': 'a'}, 'bar': 'n'} however, the key "foo" is already used and represents the old file. The dirstate: D foo A foo/barbar cannot be represented, hence the need for a new structure. == The new structure == 'directory' class. Represents one directory level. * Notable attributes: Two dictionaries: - 'files' Maps filename -> status for the current dir. - 'dirs' Maps subdir's name -> directory object representing the subdir * methods - walk(), formerly server.walk - lookup(), old server.lookup - dir(), old server.dir This new class allows embedding all the tree walks/lookups in its own class, instead of having everything mixed together in server. Incidently, since files and directories are not stored in the same dictionaries, we are solving the previous key conflict problem. The small drawback is that lookup operation is a bit more complex: for a path a/b/c/d/e we have to check twice the leaf, if e is a directory or a file.

File last commit:

r7772:88887054 default
r9115:b55d4471 default
Show More
test-mq-guards
161 lines | 2.5 KiB | text/plain | TextLexer
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 #!/bin/sh
Thomas Arendsen Hein
Make tests append settings to $HGRCPATH instead of $HGTMP/.hgrc...
r2990 echo "[extensions]" >> $HGRCPATH
echo "mq=" >> $HGRCPATH
Vadim Gelfer
mq: new commands qselect, qguard...
r2821
hg init
hg qinit
echo x > x
hg ci -Ama
hg qnew a.patch
echo a > a
hg add a
hg qrefresh
hg qnew b.patch
echo b > b
hg add b
hg qrefresh
hg qnew c.patch
echo c > c
hg add c
hg qrefresh
hg qpop -a
echo % should fail
Christian Ebert
mq: abort cleanly when invalid patch name is given to qguard
r4133 hg qguard does-not-exist.patch +bleh
echo % should fail
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 hg qguard +fail
hg qpush
echo % should guard a.patch
hg qguard +a
echo % should print +a
hg qguard
hg qpop
Brendan Cully
mq: gracefully abort qpush/qgoto to guarded patch (issue1186)
r7398 echo % should fail
hg qpush a.patch
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 hg qguard a.patch
echo % should push b.patch
hg qpush
hg qpop
Patrick Mezard
mq: make qselect fail properly on an empty guard
r6607 echo % test selection of an empty guard
hg qselect ""
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 hg qselect a
echo % should push a.patch
hg qpush
Augie Fackler
fancyopts: Parse options that occur after arguments....
r7772 hg qguard -- c.patch -a
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 echo % should print -a
hg qguard c.patch
echo % should skip c.patch
hg qpush -a
Patrick Mezard
Test qtop breaking when series ends with guarded patches.
r4405 echo % should display b.patch
hg qtop
Vadim Gelfer
mq: new commands qselect, qguard...
r2821
hg qguard -n c.patch
echo % should push c.patch
hg qpush -a
hg qpop -a
hg qselect -n
Vadim Gelfer
mq: make guards more strict, add tests
r2829 echo % should push all
Vadim Gelfer
mq: new commands qselect, qguard...
r2821 hg qpush -a
Vadim Gelfer
mq: make guards more strict, add tests
r2829
hg qpop -a
Vadim Gelfer
mq: apply patch is any posative guard matches...
r2850 hg qguard a.patch +1
hg qguard b.patch +2
Vadim Gelfer
mq: make guards more strict, add tests
r2829 hg qselect 1
Vadim Gelfer
mq: apply patch is any posative guard matches...
r2850 echo % should push a.patch, not b.patch
hg qpush
hg qpush
hg qpop -a
hg qselect 2
Vadim Gelfer
mq: make guards more strict, add tests
r2829 echo % should push b.patch
hg qpush
Patrick Mezard
mq: test qtop with holes in the patch sequence.
r4340 hg qpush -a
# Used to be an issue with holes in the patch sequence
# So, put one hole on the base and ask for topmost patch.
hg qtop
Vadim Gelfer
mq: make guards more strict, add tests
r2829 hg qpop -a
Vadim Gelfer
mq: apply patch is any posative guard matches...
r2850 hg qselect 1 2
echo % should push a.patch, b.patch
Vadim Gelfer
mq: make guards more strict, add tests
r2829 hg qpush
hg qpush
hg qpop -a
Augie Fackler
fancyopts: Parse options that occur after arguments....
r7772 hg qguard -- a.patch +1 +2 -3
Vadim Gelfer
mq: make guards more strict, add tests
r2829 hg qselect 1 2 3
Vadim Gelfer
mq: apply patch is any posative guard matches...
r2850 echo % list patches and guards
hg qguard -l
echo % list series
hg qseries -v
echo % list guards
hg qselect
Vadim Gelfer
mq: make guards more strict, add tests
r2829 echo % should push b.patch
hg qpush
Vadim Gelfer
qselect: add --pop, --reapply options
r2844
hg qpush -a
hg qselect -n --reapply
Vadim Gelfer
mq: apply patch is any posative guard matches...
r2850 echo % guards in series file: +1 +2 -3
hg qselect -s
echo % should show c.patch
hg qapplied
Mathieu Clabaut
Issue424: mq patch loses guard when qrenamed
r3685
hg qrename a.patch new.patch
echo % should show :
echo % new.patch: +1 +2 -3
echo % b.patch: +2
echo % c.patch: unguarded
hg qguard -l
Alexis S. L. Carvalho
fix qseries -v and guards interaction...
r3763 hg qnew d.patch
hg qpop
echo % should show new.patch and b.patch as Guarded, c.patch as Applied
echo % and d.patch as Unapplied
hg qseries -v
Mathieu Clabaut
Issue424: mq patch loses guard when qrenamed
r3685
Alexis S. L. Carvalho
fix qseries -v and guards interaction...
r3763 hg qguard d.patch +2
echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
hg qseries -v
Thomas Arendsen Hein
Tests for qapplied/qunapplied fixes (417c2068cb92 and ce6c364ebb2a)
r4240
qappunappv()
Jim Hague
tests: make test-mq-guards work with ksh
r5471 {
Thomas Arendsen Hein
Tests for qapplied/qunapplied fixes (417c2068cb92 and ce6c364ebb2a)
r4240 for command in qapplied "qapplied -v" qunapplied "qunapplied -v"; do
echo % hg $command
hg $command
done
Jim Hague
tests: make test-mq-guards work with ksh
r5471 }
Thomas Arendsen Hein
Tests for qapplied/qunapplied fixes (417c2068cb92 and ce6c364ebb2a)
r4240
hg qpop -a
hg qguard -l
qappunappv
hg qselect 1
qappunappv
hg qpush -a
qappunappv
hg qselect 2
qappunappv
for patch in `hg qseries`; do
echo % hg qapplied $patch
hg qapplied $patch
echo % hg qunapplied $patch
hg qunapplied $patch
done
Thomas Arendsen Hein
hg qseries -m: guards file was not ignored
r4241
echo % hg qseries -m: only b.patch should be shown
echo the guards file was not ignored in the past
hg qdelete -k b.patch
hg qseries -m