Skip to content
Snippets Groups Projects
Commit 25079cc2016f authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

drawdag: document and augment file creation capability

In order to test some stream clone related feature, we need to be able to create
file with more complex name and delete them.

We document the file related feature in the process.
parent d686448e8eb6
No related branches found
No related tags found
2 merge requests!1322merge 7.0rc1 into default,!1310stream: audit path on encoded path
This commit is part of merge request !1322. Comments created here will be created in the context of that merge request.
......@@ -82,7 +82,8 @@
Special comment can also be used to control file content for some revision.
The example below create two extra files in A, update on in B.
The example below create two extra files in A, update on in B and delete the
other on in C (using a special content to mark the deletion).
In all case the file matching the node name is created for all non-merge
commit.
......@@ -90,7 +91,7 @@
C # A/file/path=content in A
| # A/other/file/path=content for another file
B # B/file/path=updated content in B
|
| # C/other/file/path=<deleted>
A
"""
......@@ -313,7 +314,10 @@
self._parents.append(repo[repo.nullid])
def filectx(self, key):
return simplefilectx(key, self._added[key])
content = self._added.get(key)
if content is not None:
return simplefilectx(key, content)
return None
def commit(self):
return self._repo.commitctx(self)
......@@ -394,6 +398,6 @@
# parse comments to get extra file content instructions
files = collections.defaultdict(dict) # {(name, path): content}
comments = list(_getcomments(text))
filere = re.compile(br'^(\w+)/([\w/]+)\s*=\s*(.*)$', re.M)
filere = re.compile(br'^(\w+)/([-_\w/"]+)\s*=\s*(.*)$', re.M)
for name, path, content in filere.findall(b'\n'.join(comments)):
content = content.replace(br'\n', b'\n').replace(br'\1', b'\1')
......@@ -398,6 +402,9 @@
for name, path, content in filere.findall(b'\n'.join(comments)):
content = content.replace(br'\n', b'\n').replace(br'\1', b'\1')
files[name][path] = content
if content == b"<deleted>":
files[name][path] = None
else:
files[name][path] = content
committed = {None: repo.nullid} # {name: node}
......
......@@ -242,8 +242,12 @@
> |\ # B/dir2/b = 34
> A B # C/dir1/c = 5
> # C/dir2/c = 6
> # A/to-be"deleted" = I am doomed.
> # B/to-be-deleted_too = The end is near.
> # C/to-be"deleted"=<deleted>
> # C/to-be-deleted_too = <deleted>
> # C/A = a
> # C/B = b
> EOS
$ hg log -G -T '{desc} {files}'
......@@ -245,7 +249,7 @@
> # C/A = a
> # C/B = b
> EOS
$ hg log -G -T '{desc} {files}'
o C A B dir1/c dir2/c
o C A B dir1/c dir2/c to-be"deleted" to-be-deleted_too
|\
......@@ -251,3 +255,3 @@
|\
| o B B dir2/b
| o B B dir2/b to-be-deleted_too
|
......@@ -253,8 +257,8 @@
|
o A A dir1/a
o A A dir1/a to-be"deleted"
$ for r in `hg log -T '{rev} ' --rev "sort(all())"`; do
> hg log --rev $r -T "### {tags} ###\n";
> hg diff --change $r --stat;
> done
### A ###
......@@ -255,10 +259,11 @@
$ for r in `hg log -T '{rev} ' --rev "sort(all())"`; do
> hg log --rev $r -T "### {tags} ###\n";
> hg diff --change $r --stat;
> done
### A ###
A | 1 +
dir1/a | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
A | 1 +
dir1/a | 2 ++
to-be"deleted" | 1 +
3 files changed, 4 insertions(+), 0 deletions(-)
### B ###
......@@ -264,5 +269,6 @@
### B ###
B | 1 +
dir2/b | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
B | 1 +
dir2/b | 1 +
to-be-deleted_too | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
### C tip ###
......@@ -268,10 +274,11 @@
### C tip ###
A | 1 +
B | 2 +-
dir1/a | 2 ++
dir1/c | 1 +
dir2/c | 1 +
5 files changed, 6 insertions(+), 1 deletions(-)
A | 2 +-
B | 1 +
dir1/c | 1 +
dir2/b | 1 +
dir2/c | 1 +
to-be"deleted" | 1 -
6 files changed, 5 insertions(+), 2 deletions(-)
$ hg files -r C
A
B
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment