tests/test-convert-splicemap.t
author Idan Kamara <idankk86@gmail.com>
Mon, 25 Jul 2011 15:03:02 +0300
changeset 14927 2aa3e07b2f07
parent 12531 a1cbcc1a21f6
child 15608 63ff8fe3a8f0
permissions -rw-r--r--
posix, windows: introduce cachestat This class contains a stat result, and possibly other file info to reliably determine between two points in time whether a file has changed. Uniquely identifying a file gives us that reliability because we either atomic rename or append. So one of two will happen: the file 'id' will change, or the size of the file will change. posix implements it simply by calling os.stat() and checking if the result has st_ino. For now on Windows we always assume the path is uncacheable. This can be improved on NTFS due to file IDs: http://msdn.microsoft.com/en-us/library/aa363788(v=vs.85).aspx So we need to find out if a file path is on an NTFS drive, for that we have: - GetVolumeInformation, which unfortunately only works with a root path (but is available on XP) - GetVolumeInformationByHandleW, works on a full file path but requires Vista or higher
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     1
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     2
  $ echo "[extensions]" >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     3
  $ echo "convert=" >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     4
  $ echo 'graphlog =' >> $HGRCPATH
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     5
  $ glog()
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     6
  > {
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     7
  >     hg glog --template '{rev} "{desc|firstline}" files: {files}\n' "$@"
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     8
  > }
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
     9
  $ hg init repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    10
  $ cd repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    11
  $ echo a > a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    12
  $ hg ci -Am adda
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    13
  adding a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    14
  $ echo b > b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    15
  $ echo a >> a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    16
  $ hg ci -Am addb
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    17
  adding b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    18
  $ PARENTID1=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    19
  $ echo c > c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    20
  $ hg ci -Am addc
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    21
  adding c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    22
  $ PARENTID2=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    23
  $ cd ..
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    24
  $ hg init repo2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    25
  $ cd repo2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    26
  $ echo b > a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    27
  $ echo d > d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    28
  $ hg ci -Am addaandd
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    29
  adding a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    30
  adding d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    31
  $ CHILDID1=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    32
  $ echo d >> d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    33
  $ hg ci -Am changed
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    34
  $ CHILDID2=`hg id --debug -i`
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    35
  $ echo e > e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    36
  $ hg ci -Am adde
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    37
  adding e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    38
  $ cd ..
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    39
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    40
test invalid splicemap
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    41
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    42
  $ cat > splicemap <<EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    43
  > $CHILDID2
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    44
  > EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    45
  $ hg convert --splicemap splicemap repo2 repo1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    46
  abort: syntax error in splicemap(1): key/value pair expected
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    47
  [255]
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    48
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    49
splice repo2 on repo1
8047
04c62275cbc7 convert: better mapfile parsing errors (issue1581/1)
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    50
12531
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    51
  $ cat > splicemap <<EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    52
  > $CHILDID1 $PARENTID1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    53
  > $CHILDID2 $PARENTID2,$CHILDID1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    54
  > EOF
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    55
  $ hg clone repo1 target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    56
  updating to branch default
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    57
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    58
  $ hg convert --splicemap splicemap repo2 target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    59
  scanning source...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    60
  sorting...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    61
  converting...
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    62
  2 addaandd
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    63
  spliced in ['6d4c2037ddc2cb2627ac3a244ecce35283268f8e'] as parents of 527cdedf31fbd5ea708aa14eeecf53d4676f38db
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    64
  1 changed
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    65
  spliced in ['e55c719b85b60e5102fac26110ba626e7cb6b7dc', '527cdedf31fbd5ea708aa14eeecf53d4676f38db'] as parents of e4ea00df91897da3079a10fab658c1eddba6617b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    66
  0 adde
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    67
  $ glog -R target1
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    68
  o  5 "adde" files: e
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    69
  |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    70
  o    4 "changed" files: d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    71
  |\
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    72
  | o  3 "addaandd" files: a d
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    73
  | |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    74
  @ |  2 "addc" files: c
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    75
  |/
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    76
  o  1 "addb" files: a b
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    77
  |
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    78
  o  0 "adda" files: a
a1cbcc1a21f6 tests: unify test-convert-splicemap
Matt Mackall <mpm@selenic.com>
parents: 10119
diff changeset
    79