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

r8849:80cc4b1a default
r9115:b55d4471 default
Show More
test-grep.out
50 lines | 1.1 KiB | text/plain | TextLexer
Giorgos Keramidas
hg grep: handle re.compile errors & update tests/test-grep
r4877 % pattern error
Thomas Arendsen Hein
Remove trailing ! from two error messages as this was confusing.
r6057 grep: invalid match pattern: nothing to repeat
Benoit Boissinot
grep: incrementing is always False during 'iter'
r3950 % simple
bos@serpentine.internal.keyresearch.com
Add test-grep.out file for now.
r1148 port:4:export
port:4:vaportight
port:4:import/export
Benoit Boissinot
grep: incrementing is always False during 'iter'
r3950 % all
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 port:4:4:-:spam:import/export
port:3:4:+:eggs:import/export
port:2:1:-:spam:import
port:2:2:-:spam:export
port:2:1:+:spam:export
port:2:2:+:spam:vaportight
port:2:3:+:spam:import/export
port:1:2:+:eggs:export
Matt Mackall
Fixups for hg grep...
r3523 port:0:1:+:spam:import
Benoit Boissinot
grep: incrementing is always False during 'iter'
r3950 % other
bos@serpentine.internal.keyresearch.com
Add test-grep.out file for now.
r1148 port:4:import/export
Brendan Cully
grep: add --follow support.
r2870 % follow
port:0:import
port2:6:4:+:eggs:deport
port:4:4:-:spam:import/export
port:3:4:+:eggs:import/export
port:2:1:-:spam:import
port:2:2:-:spam:export
port:2:1:+:spam:export
port:2:2:+:spam:vaportight
port:2:3:+:spam:import/export
port:1:2:+:eggs:export
Matt Mackall
Fixups for hg grep...
r3523 port:0:1:+:spam:import
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 color:3:orange
color:3:+:orange
color:2:-:orange
color:1:+:orange
Christian Ebert
test 261a9f47b44b: grep w/ match in last line w/o newline...
r7240 % match in last line without newline
adding noeol
% last character omitted in output to avoid infinite loop
noeol:4:no infinite loo
Patrick Mezard
test-grep: test issue 685
r5106 % issue 685
adding color
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 colour:1:octarine
Patrick Mezard
test-grep: test issue 685
r5106 color:0:octarine
colour:1:octarine
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 % issue 337
adding color
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
color:3:-:red
color:1:+:red