##// END OF EJS Templates
wireprotov2: implement commands as a generator of objects...
wireprotov2: implement commands as a generator of objects Previously, wire protocol version 2 inherited version 1's model of having separate types to represent the results of different wire protocol commands. As I implemented more powerful commands in future commits, I found I was using a common pattern of returning a special type to hold a generator. This meant the command function required a closure to do most of the work. That made logic flow more difficult to follow. I also noticed that many commands were effectively a sequence of objects to be CBOR encoded. I think it makes sense to define version 2 commands as generators. This way, commands can simply emit the data structures they wish to send to the client. This eliminates the need for a closure in command functions and removes encoding from the bodies of commands. As part of this commit, the handling of response objects has been moved into the serverreactor class. This puts the reactor in the driver's seat with regards to CBOR encoding and error handling. Having error handling in the function that emits frames is particularly important because exceptions in that function can lead to things getting in a bad state: I'm fairly certain that uncaught exceptions in the frame generator were causing deadlocks. I also introduced a dedicated error type for explicit error reporting in command handlers. This will be used in subsequent commits. There's still a bit of work to be done here, especially around formalizing the error handling "protocol." I've added yet another TODO to track this so we don't forget. Test output changed because we're using generators and no longer know we are at the end of the data until we hit the end of the generator. This means we can't emit the end-of-stream flag until we've exhausted the generator. Hence the introduction of 0-sized end-of-stream frames. Differential Revision: https://phab.mercurial-scm.org/D4472

File last commit:

r37132:a8a0cafc default
r39595:07b58266 default
Show More
test-pathconflicts-merge.t
161 lines | 4.5 KiB | text/troff | Tads3Lexer
/ tests / test-pathconflicts-merge.t
Siddharth Agarwal
merge: disable path conflict checking by default (issue5716)...
r34943 Path conflict checking is currently disabled by default because of issue5716.
Turn it on for this test.
$ cat >> $HGRCPATH << EOF
> [experimental]
> merge.checkpathconflicts=True
> EOF
Mark Thomas
tests: add test for path conflicts during merge...
r34559 $ hg init repo
$ cd repo
$ echo base > base
$ hg add base
$ hg commit -m "base"
$ hg bookmark -i base
$ mkdir a
$ echo 1 > a/b
$ hg add a/b
$ hg commit -m "file"
$ hg bookmark -i file
$ echo 2 > a/b
$ hg commit -m "file2"
$ hg bookmark -i file2
$ hg up 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
Matt Harbison
test-pathconflicts-merge: stop requiring symlink support...
r37132
#if symlink
Mark Thomas
tests: add test for path conflicts during merge...
r34559 $ mkdir a
$ ln -s c a/b
$ hg add a/b
$ hg commit -m "link"
created new head
Matt Harbison
test-pathconflicts-merge: stop requiring symlink support...
r37132 #else
$ hg import -q --bypass - <<EOF
> # HG changeset patch
> link
>
> diff --git a/a/b b/a/b
> new file mode 120000
> --- /dev/null
> +++ b/a/b
> @@ -0,0 +1,1 @@
> +c
> \ No newline at end of file
> EOF
$ hg up -q
#endif
Mark Thomas
tests: add test for path conflicts during merge...
r34559 $ hg bookmark -i link
$ hg up 0
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ mkdir -p a/b/c
$ echo 2 > a/b/c/d
$ hg add a/b/c/d
$ hg commit -m "dir"
created new head
$ hg bookmark -i dir
Merge - local file conflicts with remote directory
$ hg up file
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(activating bookmark file)
$ hg bookmark -i
$ hg merge --verbose dir
resolving manifests
a/b: path conflict - a file or link has the same name as a directory
the local file has been renamed to a/b~0ed027b96f31
resolve manually then use 'hg resolve --mark a/b'
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 moving a/b to a/b~0ed027b96f31
Mark Thomas
tests: add test for path conflicts during merge...
r34559 getting a/b/c/d
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Mark Thomas
tests: add test for path conflicts during merge...
r34559 [1]
$ hg status
M a/b/c/d
A a/b~0ed027b96f31
R a/b
$ hg resolve --all
a/b: path conflict must be resolved manually
$ hg forget a/b~0ed027b96f31 && rm a/b~0ed027b96f31
$ hg resolve --mark a/b
(no more unresolved files)
$ hg commit -m "merge file and dir (deleted file)"
Merge - local symlink conflicts with remote directory
$ hg up link
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
(activating bookmark link)
$ hg bookmark -i
$ hg merge dir
a/b: path conflict - a file or link has the same name as a directory
the local file has been renamed to a/b~2ea68033e3be
resolve manually then use 'hg resolve --mark a/b'
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Mark Thomas
tests: add test for path conflicts during merge...
r34559 [1]
$ hg status
M a/b/c/d
A a/b~2ea68033e3be
R a/b
$ hg resolve --list
P a/b
$ hg resolve --all
a/b: path conflict must be resolved manually
$ hg mv a/b~2ea68033e3be a/b.old
$ hg resolve --mark a/b
(no more unresolved files)
$ hg resolve --list
R a/b
$ hg commit -m "merge link and dir (renamed link)"
Merge - local directory conflicts with remote file or link
$ hg up dir
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
(activating bookmark dir)
$ hg bookmark -i
$ hg merge file
a/b: path conflict - a file or link has the same name as a directory
the remote file has been renamed to a/b~0ed027b96f31
resolve manually then use 'hg resolve --mark a/b'
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Mark Thomas
tests: add test for path conflicts during merge...
r34559 [1]
$ hg status
A a/b~0ed027b96f31
$ hg resolve --all
a/b: path conflict must be resolved manually
$ hg mv a/b~0ed027b96f31 a/b/old-b
$ hg resolve --mark a/b
(no more unresolved files)
$ hg commit -m "merge dir and file (move file into dir)"
created new head
$ hg merge file2
merging a/b/old-b and a/b to a/b/old-b
0 files updated, 1 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ cat a/b/old-b
2
$ hg commit -m "merge file2 (copytrace tracked rename)"
$ hg merge link
a/b: path conflict - a file or link has the same name as a directory
the remote file has been renamed to a/b~2ea68033e3be
resolve manually then use 'hg resolve --mark a/b'
1 files updated, 0 files merged, 0 files removed, 1 files unresolved
Pulkit Goyal
merge: add `--abort` flag which can abort the merge...
r35722 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
Mark Thomas
tests: add test for path conflicts during merge...
r34559 [1]
$ hg mv a/b~2ea68033e3be a/b.old
Matt Harbison
test-pathconflicts-merge: stop requiring symlink support...
r37132
#if symlink
Augie Fackler
tests: use readlink.py instead of readlink...
r34572 $ readlink.py a/b.old
a/b.old -> c
Matt Harbison
test-pathconflicts-merge: stop requiring symlink support...
r37132 #else
$ cat a/b.old
c (no-eol)
#endif
Mark Thomas
tests: add test for path conflicts during merge...
r34559 $ hg resolve --mark a/b
(no more unresolved files)
$ hg commit -m "merge link (rename link)"