tests/test-convert-bzr.t
changeset 12512 8d84166d34d7
parent 8470 dd24488cba2d
child 15441 e0348815e806
equal deleted inserted replaced
12511:0fefeb4fff49 12512:8d84166d34d7
       
     1 
       
     2   $ . "$TESTDIR/bzr-definitions"
       
     3 
       
     4 create and rename on the same file in the same step
       
     5 
       
     6   $ mkdir test-createandrename
       
     7   $ cd test-createandrename
       
     8   $ bzr init -q source
       
     9   $ cd source
       
    10   $ echo a > a
       
    11   $ echo c > c
       
    12   $ echo e > e
       
    13   $ bzr add -q a c e
       
    14   $ bzr commit -q -m 'Initial add: a, c, e'
       
    15   $ bzr mv a b
       
    16   a => b
       
    17   $ bzr mv c d
       
    18   c => d
       
    19   $ bzr mv e f
       
    20   e => f
       
    21   $ echo a2 >> a
       
    22   $ mkdir e
       
    23   $ bzr add -q a e
       
    24   $ bzr commit -q -m 'rename a into b, create a, rename c into d'
       
    25   $ cd ..
       
    26   $ hg convert source source-hg
       
    27   initializing destination source-hg repository
       
    28   scanning source...
       
    29   sorting...
       
    30   converting...
       
    31   1 Initial add: a, c, e
       
    32   0 rename a into b, create a, rename c into d
       
    33   $ glog -R source-hg
       
    34   o  1 "rename a into b, create a, rename c into d" files: a b c d e f
       
    35   |
       
    36   o  0 "Initial add: a, c, e" files: a c e
       
    37   
       
    38 
       
    39 manifest
       
    40 
       
    41   $ hg manifest -R source-hg -r tip
       
    42   a
       
    43   b
       
    44   d
       
    45   f
       
    46 
       
    47 test --rev option
       
    48 
       
    49   $ hg convert -r 1 source source-1-hg
       
    50   initializing destination source-1-hg repository
       
    51   scanning source...
       
    52   sorting...
       
    53   converting...
       
    54   0 Initial add: a, c, e
       
    55   $ glog -R source-1-hg
       
    56   o  0 "Initial add: a, c, e" files: a c e
       
    57   
       
    58 
       
    59 test with filemap
       
    60 
       
    61   $ cat > filemap <<EOF
       
    62   > exclude a
       
    63   > EOF
       
    64   $ hg convert --filemap filemap source source-filemap-hg
       
    65   initializing destination source-filemap-hg repository
       
    66   scanning source...
       
    67   sorting...
       
    68   converting...
       
    69   1 Initial add: a, c, e
       
    70   0 rename a into b, create a, rename c into d
       
    71   $ hg -R source-filemap-hg manifest -r tip
       
    72   b
       
    73   d
       
    74   f
       
    75 
       
    76 convert from lightweight checkout
       
    77 
       
    78   $ bzr checkout --lightweight source source-light
       
    79   $ hg convert source-light source-light-hg
       
    80   initializing destination source-light-hg repository
       
    81   warning: lightweight checkouts may cause conversion failures, try with a regular branch instead.
       
    82   scanning source...
       
    83   sorting...
       
    84   converting...
       
    85   1 Initial add: a, c, e
       
    86   0 rename a into b, create a, rename c into d
       
    87 
       
    88 lightweight manifest
       
    89 
       
    90   $ hg manifest -R source-light-hg -r tip
       
    91   a
       
    92   b
       
    93   d
       
    94   f
       
    95 
       
    96 extract timestamps that look just like hg's {date|isodate}:
       
    97 yyyy-mm-dd HH:MM zzzz (no seconds!)
       
    98 compare timestamps
       
    99 
       
   100   $ cd source
       
   101   $ bzr log | \
       
   102   >   sed '/timestamp/!d;s/.\{15\}\([0-9: -]\{16\}\):.. \(.[0-9]\{4\}\)/\1 \2/' \
       
   103   >   > ../bzr-timestamps
       
   104   $ cd ..
       
   105   $ hg -R source-hg log --template "{date|isodate}\n" > hg-timestamps
       
   106   $ diff -u bzr-timestamps hg-timestamps
       
   107   $ cd ..
       
   108 
       
   109 merge
       
   110 
       
   111   $ mkdir test-merge
       
   112   $ cd test-merge
       
   113   $ cat > helper.py <<EOF
       
   114   > import sys
       
   115   > from bzrlib import workingtree
       
   116   > wt = workingtree.WorkingTree.open('.')
       
   117   > 
       
   118   > message, stamp = sys.argv[1:]
       
   119   > wt.commit(message, timestamp=int(stamp))
       
   120   > EOF
       
   121   $ bzr init -q source
       
   122   $ cd source
       
   123   $ echo content > a
       
   124   $ echo content2 > b
       
   125   $ bzr add -q a b
       
   126   $ bzr commit -q -m 'Initial add'
       
   127   $ cd ..
       
   128   $ bzr branch -q source source-improve
       
   129   $ cd source
       
   130   $ echo more >> a
       
   131   $ python ../helper.py 'Editing a' 100
       
   132   $ cd ../source-improve
       
   133   $ echo content3 >> b
       
   134   $ python ../helper.py 'Editing b' 200
       
   135   $ cd ../source
       
   136   $ bzr merge -q ../source-improve
       
   137   $ bzr commit -q -m 'Merged improve branch'
       
   138   $ cd ..
       
   139   $ hg convert --datesort source source-hg
       
   140   initializing destination source-hg repository
       
   141   scanning source...
       
   142   sorting...
       
   143   converting...
       
   144   3 Initial add
       
   145   2 Editing a
       
   146   1 Editing b
       
   147   0 Merged improve branch
       
   148   $ glog -R source-hg
       
   149   o    3 "Merged improve branch" files:
       
   150   |\
       
   151   | o  2 "Editing b" files: b
       
   152   | |
       
   153   o |  1 "Editing a" files: a
       
   154   |/
       
   155   o  0 "Initial add" files: a b
       
   156   
       
   157   $ cd ..
       
   158 
       
   159 symlinks and executable files
       
   160 
       
   161   $ mkdir test-symlinks
       
   162   $ cd test-symlinks
       
   163   $ bzr init -q source
       
   164   $ cd source
       
   165   $ touch program
       
   166   $ chmod +x program
       
   167   $ ln -s program altname
       
   168   $ mkdir d
       
   169   $ echo a > d/a
       
   170   $ ln -s a syma
       
   171   $ bzr add -q altname program syma d/a
       
   172   $ bzr commit -q -m 'Initial setup'
       
   173   $ touch newprog
       
   174   $ chmod +x newprog
       
   175   $ rm altname
       
   176   $ ln -s newprog altname
       
   177   $ chmod -x program
       
   178   $ bzr add -q newprog
       
   179   $ bzr commit -q -m 'Symlink changed, x bits changed'
       
   180   $ cd ..
       
   181   $ hg convert source source-hg
       
   182   initializing destination source-hg repository
       
   183   scanning source...
       
   184   sorting...
       
   185   converting...
       
   186   1 Initial setup
       
   187   0 Symlink changed, x bits changed
       
   188   $ manifest source-hg 0
       
   189   % manifest of 0
       
   190   644 @ altname
       
   191   644   d/a
       
   192   755 * program
       
   193   644 @ syma
       
   194   $ manifest source-hg tip
       
   195   % manifest of tip
       
   196   644 @ altname
       
   197   644   d/a
       
   198   755 * newprog
       
   199   644   program
       
   200   644 @ syma
       
   201   $ cd source-hg
       
   202 
       
   203 test the symlinks can be recreated
       
   204 
       
   205   $ hg up
       
   206   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   207   $ hg cat syma; echo
       
   208   a
       
   209