test-origbackup-conflict.t
136 lines
| 3.3 KiB
| text/troff
|
Tads3Lexer
/ tests / test-origbackup-conflict.t
Mark Thomas
|
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
|
r35007 | Make a dir named b that contains a file, and a file named d | ||
Mark Thomas
|
r34544 | |||
$ mkdir -p b | ||||
$ echo c1 > b/c | ||||
Mark Thomas
|
r35007 | $ echo d1 > d | ||
$ hg add b/c d | ||||
Mark Thomas
|
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
|
r35394 | creating directory: $TESTTMP/repo/.hg/origbackups/b | ||
Mark Thomas
|
r35007 | getting d | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Mark Thomas
|
r34544 | (activating bookmark c1) | ||
$ test -f .hg/origbackups/b/c | ||||
Mark Thomas
|
r35007 | Make files named b and d | ||
Mark Thomas
|
r34544 | |||
$ hg up -q 0 | ||||
$ echo b1 > b | ||||
Mark Thomas
|
r35007 | $ echo d2 > d | ||
$ hg add b d | ||||
Mark Thomas
|
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
|
r35394 | removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b | ||
Mark Thomas
|
r35007 | getting d | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Mark Thomas
|
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
|
r35394 | creating directory: $TESTTMP/repo/.hg/origbackups/b | ||
removing conflicting file: $TESTTMP/repo/.hg/origbackups/b | ||||
Mark Thomas
|
r35007 | getting d | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Mark Thomas
|
r34544 | (activating bookmark c1) | ||
$ test -d .hg/origbackups/b | ||||
Mark Thomas
|
r35007 | Cause two symlinks to be backed up that points to a valid location from the backup dir | ||
Mark Thomas
|
r34544 | |||
$ hg up -q 0 | ||||
$ mkdir ../sym-link-target | ||||
Matt Harbison
|
r34692 | #if symlink | ||
Mark Thomas
|
r34544 | $ ln -s ../../../sym-link-target b | ||
Mark Thomas
|
r35007 | $ ln -s ../../../sym-link-target d | ||
Matt Harbison
|
r34692 | #else | ||
Mark Thomas
|
r35007 | $ touch b d | ||
Matt Harbison
|
r34692 | #endif | ||
Mark Thomas
|
r34544 | $ hg up b1 | ||
b: replacing untracked file | ||||
Mark Thomas
|
r35007 | d: replacing untracked file | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Mark Thomas
|
r34544 | (activating bookmark b1) | ||
Matt Harbison
|
r34692 | #if symlink | ||
Augie Fackler
|
r34571 | $ readlink.py .hg/origbackups/b | ||
.hg/origbackups/b -> ../../../sym-link-target | ||||
Matt Harbison
|
r34692 | #endif | ||
Mark Thomas
|
r34544 | |||
Mark Thomas
|
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
|
r34544 | |||
$ hg up -q 0 | ||||
$ mkdir b | ||||
$ echo c4 > b/c | ||||
Mark Thomas
|
r35007 | $ echo d3 > d | ||
Mark Thomas
|
r34544 | $ hg up --verbose c1 | ||
resolving manifests | ||||
b/c: replacing untracked file | ||||
Mark Thomas
|
r35007 | d: replacing untracked file | ||
Mark Thomas
|
r34544 | getting b/c | ||
Matt Harbison
|
r35394 | creating directory: $TESTTMP/repo/.hg/origbackups/b | ||
removing conflicting file: $TESTTMP/repo/.hg/origbackups/b | ||||
Mark Thomas
|
r35007 | getting d | ||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
Mark Thomas
|
r34544 | (activating bookmark c1) | ||
$ cat .hg/origbackups/b/c | ||||
c4 | ||||
Mark Thomas
|
r35008 | $ cat .hg/origbackups/d | ||
d3 | ||||
Mark Thomas
|
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
|
r35394 | creating directory: $TESTTMP/repo/.hg/badorigbackups/b | ||
abort: $ENOTDIR$: '$TESTTMP/repo/.hg/badorigbackups/b' | ||||
Mark Thomas
|
r34544 | [255] | ||
$ cat .hg/badorigbackups | ||||
data | ||||