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

r8756:6019e651 default
r9115:b55d4471 default
Show More
test-convert-cvs-builtincvsps.out
261 lines | 3.6 KiB | text/plain | TextLexer
/ tests / test-convert-cvs-builtincvsps.out
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 % create cvs repository
% create source directory
% import source directory
N src/a
N src/b/c
No conflicts created by this import
% checkout source directory
U src/a
U src/b/c
% commit a new revision changing b/c
checking in src/b/c,v
% convert fresh repo
initializing destination src-hg repository
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
5 log entries
creating changesets
3 changeset entries
sorting...
converting...
2 Initial revision
1 import
0 ci0
updating tags
a
c
c
% convert fresh repo with --filemap
initializing destination src-filemap repository
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
5 log entries
creating changesets
3 changeset entries
sorting...
converting...
2 Initial revision
1 import
Patrick Mezard
convert: better feedback when filtering out empty revisions...
r8611 filtering out empty revision
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 rolling back last transaction
0 ci0
updating tags
c
c
2 update tags files: .hgtags
1 ci0 files: b/c
0 Initial revision files: b/c
% commit new file revisions
checking in src/a,v
checking in src/b/c,v
% convert again
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
7 log entries
creating changesets
4 changeset entries
sorting...
converting...
0 ci1
a
a
c
c
c
% convert again with --filemap
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
7 log entries
creating changesets
4 changeset entries
sorting...
converting...
0 ci1
c
c
c
3 ci1 files: b/c
2 update tags files: .hgtags
1 ci0 files: b/c
0 Initial revision files: b/c
% commit branch
U b/c
T a
T b/c
checking in src/b/c,v
% convert again
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
8 log entries
creating changesets
5 changeset entries
sorting...
converting...
0 ci2
c
d
% convert again with --filemap
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 using builtin cvsps
collecting CVS rlog
8 log entries
creating changesets
5 changeset entries
sorting...
converting...
0 ci2
c
d
4 ci2 files: b/c
3 ci1 files: b/c
2 update tags files: .hgtags
1 ci0 files: b/c
0 Initial revision files: b/c
Frank Kingswood
test: added testcase for cvsps log message lookahead
r7594 % commit a new revision with funny log message
checking in src/a,v
% convert again
Patrick Mezard
convert/cvs: delay CVS log parsing after initialization (issue1581/2)...
r8048 connecting to cvsrepo
scanning source...
Frank Kingswood
test: added testcase for cvsps log message lookahead
r7594 using builtin cvsps
collecting CVS rlog
9 log entries
creating changesets
6 changeset entries
sorting...
converting...
0 funny
o 6 (branch) funny
| ----------------------------
| log message files: a
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 o 5 (branch) ci2 files: b/c
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756
o 4 () ci1 files: a b/c
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 |
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 o 3 () update tags files: .hgtags
|
o 2 () ci0 files: b/c
|
Frank Kingswood
convert: cvs.py - Allow user to use built-in CVS changeset code....
r6690 | o 1 (INITIAL) import files:
|/
o 0 () Initial revision files: a b/c
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 % testing debugcvsps
collecting CVS rlog
Frank Kingswood
test: added testcase for cvsps log message lookahead
r7594 9 log entries
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 creating changesets
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 8 changeset entries
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 ---------------------
PatchSet 1
Date:
Author:
Branch: HEAD
Tag: (none)
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 Branchpoints: INITIAL
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 Log:
Initial revision
Members:
a:INITIAL->1.1
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756
---------------------
PatchSet 2
Date:
Author:
Branch: HEAD
Tag: (none)
Branchpoints: INITIAL, branch
Log:
Initial revision
Members:
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 b/c:INITIAL->1.1
---------------------
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 PatchSet 3
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 Date:
Author:
Branch: INITIAL
Tag: start
Log:
import
Members:
a:1.1->1.1.1.1
b/c:1.1->1.1.1.1
---------------------
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 PatchSet 4
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 Date:
Author:
Branch: HEAD
Tag: (none)
Log:
ci0
Members:
b/c:1.1->1.2
---------------------
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 PatchSet 5
Date:
Author:
Branch: HEAD
Tag: (none)
Branchpoints: branch
Log:
ci1
Members:
a:1.1->1.2
---------------------
PatchSet 6
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 Date:
Author:
Branch: HEAD
Tag: (none)
Log:
ci1
Members:
b/c:1.2->1.3
---------------------
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 PatchSet 7
Patrick Mezard
test-convert-cvs-builtincvsps: test debugcvsps command
r7503 Date:
Author:
Branch: branch
Tag: (none)
Log:
ci2
Members:
b/c:1.1->1.1.2.1
Frank Kingswood
test: added testcase for cvsps log message lookahead
r7594 ---------------------
Henrik Stuart
convert: better support for CVS branchpoints (issue1447)...
r8756 PatchSet 8
Frank Kingswood
test: added testcase for cvsps log message lookahead
r7594 Date:
Author:
Branch: branch
Tag: (none)
Log:
funny
----------------------------
log message
Members:
a:1.2->1.2.2.1