tests/test-convert-hg-startrev.t
changeset 12148 0a0592f8e11a
parent 10119 bb5ea66789e3
child 12350 e7e3b0618d8d
equal deleted inserted replaced
12147:2b171fe378c0 12148:0a0592f8e11a
       
     1 
       
     2   $ cat > $HGRCPATH <<EOF
       
     3   > [extensions]
       
     4   > graphlog =
       
     5   > convert =
       
     6   > EOF
       
     7 
       
     8   $ glog()
       
     9   > {
       
    10   >     hg -R "$1" glog --template '{rev} "{desc}" files: {files}\n'
       
    11   > }
       
    12 
       
    13   $ hg init source
       
    14   $ cd source
       
    15 
       
    16   $ echo a > a
       
    17   $ echo b > b
       
    18   $ hg ci -d '0 0' -qAm '0: add a b'
       
    19   $ echo c > c
       
    20   $ hg ci -d '1 0' -qAm '1: add c'
       
    21   $ hg copy a e
       
    22   $ echo b >> b
       
    23   $ hg ci -d '2 0' -qAm '2: copy e from a, change b'
       
    24   $ hg up -C 0
       
    25   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
       
    26   $ echo a >> a
       
    27   $ hg ci -d '3 0' -qAm '3: change a'
       
    28   $ hg merge
       
    29   merging a and e to e
       
    30   2 files updated, 1 files merged, 0 files removed, 0 files unresolved
       
    31   (branch merge, don't forget to commit)
       
    32   $ hg copy b d
       
    33   $ hg ci -d '4 0' -qAm '4: merge 2 and 3, copy d from b'
       
    34   $ echo a >> a
       
    35   $ hg ci -d '5 0' -qAm '5: change a'
       
    36   $ cd ..
       
    37 
       
    38 Convert from null revision
       
    39 
       
    40   $ hg convert --config convert.hg.startrev=null source empty
       
    41   initializing destination empty repository
       
    42   scanning source...
       
    43   sorting...
       
    44   converting...
       
    45 
       
    46   $ glog empty
       
    47 
       
    48 Convert from zero revision
       
    49 
       
    50   $ hg convert --config convert.hg.startrev=0 source full
       
    51   initializing destination full repository
       
    52   scanning source...
       
    53   sorting...
       
    54   converting...
       
    55   5 0: add a b
       
    56   4 1: add c
       
    57   3 2: copy e from a, change b
       
    58   2 3: change a
       
    59   1 4: merge 2 and 3, copy d from b
       
    60   0 5: change a
       
    61 
       
    62   $ glog full
       
    63   o  5 "5: change a" files: a
       
    64   |
       
    65   o    4 "4: merge 2 and 3, copy d from b" files: d e
       
    66   |\
       
    67   | o  3 "3: change a" files: a
       
    68   | |
       
    69   o |  2 "2: copy e from a, change b" files: b e
       
    70   | |
       
    71   o |  1 "1: add c" files: c
       
    72   |/
       
    73   o  0 "0: add a b" files: a b
       
    74   
       
    75 Convert from merge parent
       
    76 
       
    77   $ hg convert --config convert.hg.startrev=1 source conv1
       
    78   initializing destination conv1 repository
       
    79   scanning source...
       
    80   sorting...
       
    81   converting...
       
    82   3 1: add c
       
    83   2 2: copy e from a, change b
       
    84   1 4: merge 2 and 3, copy d from b
       
    85   0 5: change a
       
    86 
       
    87   $ glog conv1
       
    88   o  3 "5: change a" files: a
       
    89   |
       
    90   o  2 "4: merge 2 and 3, copy d from b" files: a d e
       
    91   |
       
    92   o  1 "2: copy e from a, change b" files: b e
       
    93   |
       
    94   o  0 "1: add c" files: a b c
       
    95   
       
    96   $ cd conv1
       
    97 
       
    98 Check copy preservation
       
    99 
       
   100   $ hg log --follow --copies e
       
   101   changeset:   2:d67b1d48a835
       
   102   user:        test
       
   103   date:        Thu Jan 01 00:00:04 1970 +0000
       
   104   summary:     4: merge 2 and 3, copy d from b
       
   105   
       
   106   changeset:   1:462c431cf47d
       
   107   user:        test
       
   108   date:        Thu Jan 01 00:00:02 1970 +0000
       
   109   summary:     2: copy e from a, change b
       
   110   
       
   111 Check copy removal on missing parent
       
   112 
       
   113   $ hg log --follow --copies d
       
   114   changeset:   2:d67b1d48a835
       
   115   user:        test
       
   116   date:        Thu Jan 01 00:00:04 1970 +0000
       
   117   summary:     4: merge 2 and 3, copy d from b
       
   118   
       
   119   $ hg cat -r tip a b
       
   120   a
       
   121   a
       
   122   a
       
   123   b
       
   124   b
       
   125   $ hg -q verify
       
   126   $ cd ..
       
   127 
       
   128 Convert from merge
       
   129 
       
   130   $ hg convert --config convert.hg.startrev=4 source conv4
       
   131   initializing destination conv4 repository
       
   132   scanning source...
       
   133   sorting...
       
   134   converting...
       
   135   1 4: merge 2 and 3, copy d from b
       
   136   0 5: change a
       
   137   $ glog conv4
       
   138   o  1 "5: change a" files: a
       
   139   |
       
   140   o  0 "4: merge 2 and 3, copy d from b" files: a b c d e
       
   141   
       
   142   $ cd conv4
       
   143   $ hg up -C
       
   144   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   145   $ hg cat -r tip a b
       
   146   a
       
   147   a
       
   148   a
       
   149   b
       
   150   b
       
   151   $ hg -q verify
       
   152   $ cd ..