##// 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:

r7429:dbc40381 default
r9115:b55d4471 default
Show More
test-globalopts
96 lines | 1.6 KiB | text/plain | TextLexer
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293 #!/bin/sh
Mads Kiilerich
tests: Skip tests if they will fail because of outer repo...
r7429 "$TESTDIR/hghave" no-outer-repo || exit 80
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293 hg init a
cd a
echo a > a
hg ci -A -d'1 0' -m a
cd ..
hg init b
cd b
echo b > b
hg ci -A -d'1 0' -m b
cd ..
hg clone a c
cd c
hg pull -f ../b
Alexis S. L. Carvalho
change tests to use simplemerge by default
r4365 hg merge
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293
cd ..
echo %% -R/--repository
hg -R a tip
hg --repository b tip
Jesse Glick
Infer a --repository argument from command arguments when reasonable....
r6150 echo %% implicit -R
hg ann a/a
hg ann a/a a/a
hg ann a/a b/b
hg -R b ann a/a
hg log
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293 echo %% abbrev of long option
hg --repo c tip
Thomas Arendsen Hein
Added test for earlygetopt fixes (36d23de02da1 and 79cc512a34ed)
r4728 echo "%% earlygetopt with duplicate options (36d23de02da1)"
hg --cwd a --cwd b --cwd c tip
hg --repo c --repository b -R a tip
Thomas Arendsen Hein
Disallow short earlygetop option combined with other short options...
r4732 echo "%% earlygetopt short option without following space"
Thomas Arendsen Hein
Added test for earlygetopt fixes (36d23de02da1 and 79cc512a34ed)
r4728 hg -q -Rb tip
Thomas Arendsen Hein
Abort if earlygetopt fails to detect an option....
r4734 echo "%% earlygetopt with illegal abbreviations"
hg --confi "foo.bar=baz"
hg --cw a tip
hg --rep a tip
hg --repositor a tip
hg -qR a tip
hg -qRa tip
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293 echo %% --cwd
hg --cwd a parents
echo %% -y/--noninteractive - just be sure it is parsed
hg --cwd a tip -q --noninteractive
hg --cwd a tip -q -y
echo %% -q/--quiet
hg -R a -q tip
hg -R b -q tip
hg -R c --quiet parents
echo %% -v/--verbose
hg --cwd c head -v
hg --cwd b tip --verbose
echo %% --config
Danek Duvall
Fix some tests for portability.
r2843 hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293 hg --cwd c --config '' tip -q
hg --cwd c --config a.b tip -q
hg --cwd c --config a tip -q
hg --cwd c --config a.= tip -q
hg --cwd c --config .b= tip -q
echo %% --debug
hg --cwd c log --debug
echo %% --traceback
hg --cwd c --config x --traceback tip 2>&1 | grep -i 'traceback'
echo %% --time
hg --cwd a --time tip 2>&1 | grep '^Time:' | sed 's/[0-9][0-9]*/x/g'
echo %% --version
Sascha Wilde
Workaround to work with less sophisticated sed versions....
r2528 hg --version -q | sed 's/version [^)]*/version xxx/'
Vadim Gelfer
add --config global option. allows to set hgrc option on command line....
r2293
echo %% -h/--help
hg -h
hg --help
echo %% not tested: --debugger