##// END OF EJS Templates
wireprotov2: define and implement "manifestdata" command...
wireprotov2: define and implement "manifestdata" command The added command can be used for obtaining manifest data. Given a manifest path and set of manifest nodes, data about manifests can be retrieved. Unlike changeset data, we wish to emit deltas to describe manifest revisions. So the command uses the relatively new API for building delta requests and emitting them. The code calls into deltaparent(), which I'm not very keen of. There's still work to be done in delta generation land so implementation details of storage (e.g. exactly one delta is stored/available) don't creep into higher levels. But we can worry about this later (there is already a TODO on imanifestorage tracking this). On the subject of parent deltas, the server assumes parent revisions exist on the receiving end. This is obviously wrong for shallow clone. I've added TODOs to add a mechanism to the command to allow clients to specify desired behavior. This shouldn't be too difficult to implement. Another big change is that the client must explicitly request manifest nodes to retrieve. This is a major departure from "getbundle," where the server derives relevant manifests as it iterates changesets and sends them automatically. As implemented, the client must transmit each requested node to the server. At 20 bytes per node, we're looking at 2 MB per 100,000 nodes. Plus wire encoding overhead. This isn't ideal for clients with limited upload bandwidth. I plan to address this in the future by allowing alternate mechanisms for defining the revisions to retrieve. One idea is to define a range of changeset revisions whose manifest revisions to retrieve (similar to how "changesetdata" works). We almost certainly want an API to look up an individual manifest by node. And that's where I've chosen to start with the implementation. Again, a theme of this early exchangev2 work is I want to start by building primitives for accessing raw repository data first and see how far we can get with those before we need more complexity. Differential Revision: https://phab.mercurial-scm.org/D4488

File last commit:

r35231:b33d4cf3 default
r39673:c7a7c7e8 default
Show More
test-origbackup-conflict.t
136 lines | 3.3 KiB | text/troff | Tads3Lexer
/ tests / test-origbackup-conflict.t
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 Set up repo
$ cat << EOF >> $HGRCPATH
> [ui]
> origbackuppath=.hg/origbackups
> [merge]
> checkunknown=warn
> EOF
$ hg init repo
$ cd repo
$ echo base > base
$ hg add base
$ hg commit -m "base"
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 Make a dir named b that contains a file, and a file named d
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544
$ mkdir -p b
$ echo c1 > b/c
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 $ echo d1 > d
$ hg add b/c d
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ hg commit -m "c1"
$ hg bookmark c1
Peform an update that causes b/c to be backed up
$ hg up -q 0
$ mkdir -p b
$ echo c2 > b/c
$ hg up --verbose c1
resolving manifests
b/c: replacing untracked file
getting b/c
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 creating directory: $TESTTMP/repo/.hg/origbackups/b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 getting d
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 (activating bookmark c1)
$ test -f .hg/origbackups/b/c
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 Make files named b and d
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544
$ hg up -q 0
$ echo b1 > b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 $ echo d2 > d
$ hg add b d
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ hg commit -m b1
created new head
$ hg bookmark b1
Perform an update that causes b to be backed up - it should replace the backup b dir
$ hg up -q 0
$ echo b2 > b
$ hg up --verbose b1
resolving manifests
b: replacing untracked file
getting b
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 getting d
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 (activating bookmark b1)
$ test -f .hg/origbackups/b
Perform an update the causes b/c to be backed up again - it should replace the backup b file
$ hg up -q 0
$ mkdir b
$ echo c3 > b/c
$ hg up --verbose c1
resolving manifests
b/c: replacing untracked file
getting b/c
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 creating directory: $TESTTMP/repo/.hg/origbackups/b
removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 getting d
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 (activating bookmark c1)
$ test -d .hg/origbackups/b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 Cause two symlinks to be backed up that points to a valid location from the backup dir
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544
$ hg up -q 0
$ mkdir ../sym-link-target
Matt Harbison
test-conflicts: conditionalize for no-symlink platforms...
r34692 #if symlink
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ ln -s ../../../sym-link-target b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 $ ln -s ../../../sym-link-target d
Matt Harbison
test-conflicts: conditionalize for no-symlink platforms...
r34692 #else
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 $ touch b d
Matt Harbison
test-conflicts: conditionalize for no-symlink platforms...
r34692 #endif
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ hg up b1
b: replacing untracked file
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 d: replacing untracked file
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 (activating bookmark b1)
Matt Harbison
test-conflicts: conditionalize for no-symlink platforms...
r34692 #if symlink
Augie Fackler
tests: use readlink.py instead of readlink...
r34571 $ readlink.py .hg/origbackups/b
.hg/origbackups/b -> ../../../sym-link-target
Matt Harbison
test-conflicts: conditionalize for no-symlink platforms...
r34692 #endif
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 Perform an update that causes b/c and d to be backed up again - b/c should not go into the target dir
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544
$ hg up -q 0
$ mkdir b
$ echo c4 > b/c
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 $ echo d3 > d
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ hg up --verbose c1
resolving manifests
b/c: replacing untracked file
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 d: replacing untracked file
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 getting b/c
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 creating directory: $TESTTMP/repo/.hg/origbackups/b
removing conflicting file: $TESTTMP/repo/.hg/origbackups/b
Mark Thomas
tests: add a test demonstrating issue5731...
r35007 getting d
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 (activating bookmark c1)
$ cat .hg/origbackups/b/c
c4
Mark Thomas
scmutil: don't try to delete origbackup symlinks to directories (issue5731)...
r35008 $ cat .hg/origbackups/d
d3
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 $ ls ../sym-link-target
Incorrectly configure origbackuppath to be under a file
$ echo data > .hg/badorigbackups
$ hg up -q 0
$ mkdir b
$ echo c5 > b/c
$ hg up --verbose c1 --config ui.origbackuppath=.hg/badorigbackups
resolving manifests
b/c: replacing untracked file
getting b/c
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 creating directory: $TESTTMP/repo/.hg/badorigbackups/b
abort: $ENOTDIR$: '$TESTTMP/repo/.hg/badorigbackups/b'
Mark Thomas
scmutil: handle conflicting files and dirs in origbackuppath...
r34544 [255]
$ cat .hg/badorigbackups
data