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

r8884:8b603c7c default
r9115:b55d4471 default
Show More
branches.svndump
425 lines | 5.7 KiB | text/plain | TextLexer
SVN-fs-dump-format-version: 2
UUID: 3c3c228a-b3dd-467c-a766-896f4b7cd0af
Revision-number: 0
Prop-content-length: 56
Content-length: 56
K 8
svn:date
V 27
2009-06-21T12:38:53.023457Z
PROPS-END
Revision-number: 1
Prop-content-length: 112
Content-length: 112
K 7
svn:log
V 10
init projA
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:38:53.111986Z
PROPS-END
Node-path: branches
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10
PROPS-END
Node-path: tags
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10
PROPS-END
Node-path: trunk
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10
PROPS-END
Revision-number: 2
Prop-content-length: 106
Content-length: 106
K 7
svn:log
V 5
hello
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:38:54.182594Z
PROPS-END
Node-path: branches/notinbranch
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 2
Text-content-md5: e29311f6f1bf1af907f9ef9f44b8328b
Text-content-sha1: e983f374794de9c64e3d1c1de1d490c0756eeeff
Content-length: 12
PROPS-END
d
Node-path: trunk/a
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 2
Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3
Text-content-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
Content-length: 12
PROPS-END
a
Node-path: trunk/b
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 2
Text-content-md5: 3b5d5c3712955042212316173ccf37be
Text-content-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
Content-length: 12
PROPS-END
b
Node-path: trunk/c
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 2
Text-content-md5: 2cd6ee2c70b0bde53fbe6cac3c8b8bb1
Text-content-sha1: 2b66fd261ee5c6cfc8de7fa466bab600bcfe4f69
Content-length: 12
PROPS-END
c
Node-path: trunk/dir
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10
PROPS-END
Node-path: trunk/dir/e
Node-kind: file
Node-action: add
Prop-content-length: 10
Text-content-length: 2
Text-content-md5: 9ffbf43126e33be52cd2bf7e01d627f9
Text-content-sha1: 094e3afb2fe8dfe82f63731cdcd3b999f4856cff
Content-length: 12
PROPS-END
e
Revision-number: 3
Prop-content-length: 132
Content-length: 132
K 7
svn:log
V 30
branch trunk, remove c and dir
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:38:57.166484Z
PROPS-END
Node-path: branches/old
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 2
Node-copyfrom-path: trunk
Node-path: branches/old/dir
Node-action: delete
Node-path: branches/old/c
Node-action: delete
Revision-number: 4
Prop-content-length: 109
Content-length: 109
K 7
svn:log
V 8
change a
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:38:59.084420Z
PROPS-END
Node-path: trunk/a
Node-kind: file
Node-action: change
Text-content-length: 4
Text-content-md5: 0d227f1abf8c2932d342e9b99cc957eb
Text-content-sha1: d7c8127a20a396cff08af086a1c695b0636f0c29
Content-length: 4
a
a
Revision-number: 5
Prop-content-length: 109
Content-length: 109
K 7
svn:log
V 8
change b
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:00.093201Z
PROPS-END
Node-path: branches/old/b
Node-kind: file
Node-action: change
Text-content-length: 4
Text-content-md5: 06ac26ed8b614fc0b141e4542aa067c2
Text-content-sha1: f6980469e74f7125178e88ec571e06fe6ce86e95
Content-length: 4
b
b
Revision-number: 6
Prop-content-length: 119
Content-length: 119
K 7
svn:log
V 17
move and update c
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:02.078633Z
PROPS-END
Node-path: branches/old/c
Node-kind: file
Node-action: add
Node-copyfrom-rev: 3
Node-copyfrom-path: trunk/b
Text-copy-source-md5: 3b5d5c3712955042212316173ccf37be
Text-copy-source-sha1: 89e6c98d92887913cadf06b2adb97f26cde4849b
Text-content-length: 4
Text-content-md5: 33cb6785d50937d8d307ebb66d6259a7
Text-content-sha1: 7a6478264aa11a0f4befef356c03e83f2b1f6eba
Content-length: 4
b
c
Node-path: trunk/b
Node-action: delete
Revision-number: 7
Prop-content-length: 116
Content-length: 116
K 7
svn:log
V 14
change b again
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:03.065537Z
PROPS-END
Node-path: branches/old/b
Node-kind: file
Node-action: change
Text-content-length: 6
Text-content-md5: cdcfb41554e2d092c13f5e6839e63577
Text-content-sha1: 17ac58cabedebea235d1b5605531d5b1559797e9
Content-length: 6
b
b
b
Revision-number: 8
Prop-content-length: 114
Content-length: 114
K 7
svn:log
V 12
move to old2
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:06.070275Z
PROPS-END
Node-path: branches/old2
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 7
Node-copyfrom-path: branches/old
Node-path: branches/old
Node-action: delete
Revision-number: 9
Prop-content-length: 118
Content-length: 118
K 7
svn:log
V 16
move back to old
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:08.082539Z
PROPS-END
Node-path: branches/old
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 8
Node-copyfrom-path: branches/old2
Node-path: branches/old2
Node-action: delete
Revision-number: 10
Prop-content-length: 118
Content-length: 118
K 7
svn:log
V 16
last change to a
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:09.073290Z
PROPS-END
Node-path: trunk/a
Node-kind: file
Node-action: change
Text-content-length: 2
Text-content-md5: 60b725f10c9c85c70d97880dfe8191b3
Text-content-sha1: 3f786850e387550fdab836ed7e6dc881de23001b
Content-length: 2
a
Revision-number: 11
Prop-content-length: 126
Content-length: 126
K 7
svn:log
V 24
branch trunk@1 into old3
K 10
svn:author
V 7
pmezard
K 8
svn:date
V 27
2009-06-21T12:39:11.070264Z
PROPS-END
Node-path: branches/old3
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 1
Node-copyfrom-path: trunk