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

r8709:b9e0ddb0 default
r9115:b55d4471 default
Show More
test-commit.out
117 lines | 2.7 KiB | text/plain | TextLexer
Giorgos Keramidas
Expand test-commit to cover one of the recent bugs.
r3709 % commit date test
Thomas Arendsen Hein
Clarify some messages during commit:...
r5757 abort: empty commit message
Bryan O'Sullivan
Commit date validation: more stringent checks, more useful error messages.
r1202 abort: impossible time zone offset: 4444444
Matt Mackall
Update tests
r3810 abort: invalid date: '1\t15.1'
abort: invalid date: 'foo bar'
Thomas Arendsen Hein
Fix bad behaviour when specifying an invalid date (issue700)...
r6139 abort: date exceeds 32 bits: 111111111111
Alexis S. L. Carvalho
status: put added files that have disappeared in the deleted list...
r6110 % commit added file that has been deleted
nothing changed
Matt Mackall
commit: move explicit file checking into repo.commit
r8709 abort: bar: file not found!
Alexis S. L. Carvalho
make hg commit <dirname> work again
r3786 adding dir/file
dir/file
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935 committed changeset 2:d2a76177cb42
Alexis S. L. Carvalho
make hg commit <dirname> work again
r3786 adding dir.file
Matt Mackall
commit: move explicit file checking into repo.commit
r8709 abort: dir: no match under directory!
abort: bleh: no match under directory!
abort: dir2: no match under directory!
Alexis S. L. Carvalho
make hg commit <dirname> work again
r3786 dir/file
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935 committed changeset 3:1cd62a2d8db5
Matt Mackall
commit: move explicit file checking into repo.commit
r8709 abort: does-not-exist: No such file or directory
abort: baz: file not tracked!
abort: quux: file not tracked!
Alexis S. L. Carvalho
make hg commit <dirname> work again
r3786 dir/file
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935 committed changeset 4:49176991390e
Giorgos Keramidas
Expand test-commit to cover one of the recent bugs.
r3709 % partial subdir commit test
adding bar/bar
adding foo/foo
% subdir log 1
changeset: 0:6ef3cb06bb80
user: test
date: Mon Jan 12 13:46:40 1970 +0000
files: foo/foo
description:
commit-subdir-1
% subdir log 2
changeset: 1:f2e51572cf5a
tag: tip
user: test
date: Mon Jan 12 13:46:41 1970 +0000
files: bar/bar
description:
commit-subdir-2
% full log
changeset: 1:f2e51572cf5a
tag: tip
user: test
date: Mon Jan 12 13:46:41 1970 +0000
files: bar/bar
description:
commit-subdir-2
changeset: 0:6ef3cb06bb80
user: test
date: Mon Jan 12 13:46:40 1970 +0000
files: foo/foo
description:
commit-subdir-1
Giorgos Keramidas
tests: expand test-commit a bit to test 'hg commit .' too
r4253 % dot and subdir commit test
% full log
changeset: 1:d9180e04fa8a
tag: tip
user: test
date: Sat Jan 24 03:33:20 1970 +0000
files: foo/plain-file
description:
commit-foo-dot
changeset: 0:80b572aaf098
user: test
date: Mon Jan 12 13:46:40 1970 +0000
files: foo/plain-file
description:
commit-foo-subdir
% subdir log
changeset: 1:d9180e04fa8a
tag: tip
user: test
date: Sat Jan 24 03:33:20 1970 +0000
summary: commit-foo-dot
changeset: 0:80b572aaf098
user: test
date: Mon Jan 12 13:46:40 1970 +0000
summary: commit-foo-subdir
Bryan O'Sullivan
Tests for issue 1049
r6386 adding a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
created new head
merging a
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
% should fail because we are specifying a file name
abort: cannot partially commit a merge (do not specify files or patterns)
% should fail because we are specifying a pattern
abort: cannot partially commit a merge (do not specify files or patterns)
% should succeed
Patrick Mezard
Show added files as "added" in editor commit message (issue 1330)
r7072 % test commit message content
HG: Enter commit message. Lines beginning with 'HG:' are removed.
Matt Mackall
commit: explain how to abort commit in editor
r8497 HG: Leave message empty to abort commit.
Patrick Mezard
Show added files as "added" in editor commit message (issue 1330)
r7072 HG: --
HG: user: test
HG: branch 'default'
HG: added added
HG: changed changed
HG: removed removed
abort: empty commit message