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

r7566:5f7e3f17 default
r9115:b55d4471 default
Show More
test-mq-qrefresh.out
268 lines | 3.7 KiB | text/plain | TextLexer
/ tests / test-mq-qrefresh.out
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 % init
% commit
adding 1/base
adding 2/base
% qnew mqbase
% qrefresh
% qdiff
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qdiff dirname
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% patch file contents
mqbase
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qrefresh 1
% qdiff
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qdiff dirname
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% patch file contents
mqbase
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qrefresh . in subdir
% qdiff
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qdiff dirname
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% patch file contents
mqbase
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qrefresh in hg-root again
% qdiff
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% qdiff dirname
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
% patch file contents
mqbase
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
Matt Mackall
diff: don't show function name by default...
r5863 @@ -1,1 +1,1 @@
Giorgos Keramidas
tests: add new test; test-mq-qrefresh
r3136 -base
+patched
Mads Kiilerich
mq: Fix --qrefresh --short to work with --exclude and --include...
r7177
% qrefresh --short tests:
% - add 1/base and 2/base one by one
% -- qdiff output
Mads Kiilerich
mq: Allow qrefresh --silent to take parameters...
r7113 diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
@@ -1,1 +1,1 @@
-base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
@@ -1,1 +1,1 @@
-base
+patched
diff -r b55ecdccb5cf orphanchild
--- /dev/null
+++ b/orphanchild
@@ -0,0 +1,1 @@
+orphan
Mads Kiilerich
mq: Fix --qrefresh --short to work with --exclude and --include...
r7177 % -- patch file content
Mads Kiilerich
mq: Allow qrefresh --silent to take parameters...
r7113 mqbase
diff -r b55ecdccb5cf 1/base
--- a/1/base
+++ b/1/base
@@ -1,1 +1,1 @@
-base
+patched
diff -r b55ecdccb5cf 2/base
--- a/2/base
+++ b/2/base
@@ -1,1 +1,1 @@
-base
+patched
A orphanchild
? base
Mads Kiilerich
mq: Fix --qrefresh --short to work with --exclude and --include...
r7177 % -- diff shows what is not in patch
Mads Kiilerich
mq: Allow qrefresh --silent to take parameters...
r7113 diff
--- /dev/null
+++ b/orphanchild
@@ -0,0 +1,1 @@
+orphan
Mads Kiilerich
mq: Fix --qrefresh --short to work with --exclude and --include...
r7177 % - before starting exclusive tests
1/base
2/base
% - exclude 2/base
1/base
% -- status shows 2/base as dirty
M 2/base
A orphanchild
? base
% - remove 1/base and add 2/base again but not orphanchild
2/base
% - add 1/base with include filter - and thus remove 2/base from patch
1/base
Patrick Mezard
mq: fix qrefresh losing copy information (issue 1134)
r6801 % create test repo
adding a
% capture changes
diff --git a/a b/ab
copy from a
copy to ab
--- a/a
+++ b/ab
@@ -1,1 +1,2 @@
a
+b
diff --git a/a b/ac
copy from a
copy to ac
--- a/a
+++ b/ac
@@ -1,1 +1,2 @@
a
+c
% refresh and check changes again
diff --git a/a b/ab
copy from a
copy to ab
--- a/a
+++ b/ab
@@ -1,1 +1,2 @@
a
+b
diff --git a/a b/ac
copy from a
copy to ac
--- a/a
+++ b/ac
@@ -1,1 +1,2 @@
a
+c
Patrick Mezard
mq: drop copy records when refreshing regular patches (issue1441)...
r7566 % issue1441 without git patches
diff -r 000000000000 b
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+a
% issue1441 with git patches
diff --git a/b b/b
new file mode 100644
--- /dev/null
+++ b/b
@@ -0,0 +1,1 @@
+a