tests/test-convert-cvs-synthetic.t
changeset 12522 7813e6b44a0b
parent 10802 6e4cf8319f54
child 12640 6cc4b14fb76b
equal deleted inserted replaced
12521:539480ce1c89 12522:7813e6b44a0b
       
     1 This feature requires use of builtin cvsps!
       
     2 
       
     3   $ "$TESTDIR/hghave" cvs || exit 80
       
     4   $ echo "[extensions]" >> $HGRCPATH
       
     5   $ echo "convert = " >> $HGRCPATH
       
     6   $ echo "graphlog = " >> $HGRCPATH
       
     7 
       
     8 create cvs repository with one project
       
     9 
       
    10   $ mkdir cvsrepo
       
    11   $ cd cvsrepo
       
    12   $ CVSROOT=`pwd`
       
    13   $ export CVSROOT
       
    14   $ CVS_OPTIONS=-f
       
    15   $ export CVS_OPTIONS
       
    16   $ cd ..
       
    17   $ cvscall()
       
    18   > {
       
    19   >     cvs -f "$@"
       
    20   > }
       
    21 
       
    22 output of 'cvs ci' varies unpredictably, so just discard it
       
    23 
       
    24   $ cvsci()
       
    25   > {
       
    26   >     cvs -f ci "$@" >/dev/null
       
    27   > }
       
    28   $ cvscall -d "$CVSROOT" init
       
    29   $ mkdir cvsrepo/proj
       
    30   $ cvscall -q co proj
       
    31 
       
    32 create file1 on the trunk
       
    33 
       
    34   $ cd proj
       
    35   $ touch file1
       
    36   $ cvscall -Q add file1
       
    37   $ cvsci -m"add file1 on trunk" file1
       
    38 
       
    39 create two branches
       
    40 
       
    41   $ cvscall -q tag -b v1_0
       
    42   T file1
       
    43   $ cvscall -q tag -b v1_1
       
    44   T file1
       
    45 
       
    46 create file2 on branch v1_0
       
    47 
       
    48   $ cvscall -Q up -rv1_0
       
    49   $ touch file2
       
    50   $ cvscall -Q add file2
       
    51   $ cvsci -m"add file2" file2
       
    52 
       
    53 create file3, file4 on branch v1_1
       
    54 
       
    55   $ cvscall -Q up -rv1_1
       
    56   $ touch file3
       
    57   $ touch file4
       
    58   $ cvscall -Q add file3 file4
       
    59   $ cvsci -m"add file3, file4 on branch v1_1" file3 file4
       
    60 
       
    61 merge file2 from v1_0 to v1_1
       
    62 
       
    63   $ cvscall -Q up -jv1_0
       
    64   $ cvsci -m"MERGE from v1_0: add file2"
       
    65   cvs commit: Examining .
       
    66 
       
    67 Step things up a notch: now we make the history really hairy, with
       
    68 changes bouncing back and forth between trunk and v1_2 and merges
       
    69 going both ways.  (I.e., try to model the real world.)
       
    70 create branch v1_2
       
    71 
       
    72   $ cvscall -Q up -A
       
    73   $ cvscall -q tag -b v1_2
       
    74   T file1
       
    75 
       
    76 create file5 on branch v1_2
       
    77 
       
    78   $ cvscall -Q up -rv1_2
       
    79   $ touch file5
       
    80   $ cvs -Q add file5
       
    81   $ cvsci -m"add file5 on v1_2"
       
    82   cvs commit: Examining .
       
    83 
       
    84 create file6 on trunk post-v1_2
       
    85 
       
    86   $ cvscall -Q up -A
       
    87   $ touch file6
       
    88   $ cvscall -Q add file6
       
    89   $ cvsci -m"add file6 on trunk post-v1_2"
       
    90   cvs commit: Examining .
       
    91 
       
    92 merge file5 from v1_2 to trunk
       
    93 
       
    94   $ cvscall -Q up -A
       
    95   $ cvscall -Q up -jv1_2 file5
       
    96   $ cvsci -m"MERGE from v1_2: add file5"
       
    97   cvs commit: Examining .
       
    98 
       
    99 merge file6 from trunk to v1_2
       
   100 
       
   101   $ cvscall -Q up -rv1_2
       
   102   $ cvscall up -jHEAD file6
       
   103   U file6
       
   104   $ cvsci -m"MERGE from HEAD: add file6"
       
   105   cvs commit: Examining .
       
   106 
       
   107 cvs rlog output
       
   108 
       
   109   $ cvscall -q rlog proj | egrep '^(RCS file|revision)'
       
   110   RCS file: */cvsrepo/proj/file1,v (glob)
       
   111   revision 1.1
       
   112   RCS file: */cvsrepo/proj/Attic/file2,v (glob)
       
   113   revision 1.1
       
   114   revision 1.1.4.2
       
   115   revision 1.1.4.1
       
   116   revision 1.1.2.1
       
   117   RCS file: */cvsrepo/proj/Attic/file3,v (glob)
       
   118   revision 1.1
       
   119   revision 1.1.2.1
       
   120   RCS file: */cvsrepo/proj/Attic/file4,v (glob)
       
   121   revision 1.1
       
   122   revision 1.1.2.1
       
   123   RCS file: */cvsrepo/proj/file5,v (glob)
       
   124   revision 1.2
       
   125   revision 1.1
       
   126   revision 1.1.2.1
       
   127   RCS file: */cvsrepo/proj/file6,v (glob)
       
   128   revision 1.1
       
   129   revision 1.1.2.2
       
   130   revision 1.1.2.1
       
   131 
       
   132 convert to hg (#1)
       
   133 
       
   134   $ cd ..
       
   135   $ hg convert --datesort proj proj.hg
       
   136   initializing destination proj.hg repository
       
   137   connecting to */cvsrepo (glob)
       
   138   scanning source...
       
   139   collecting CVS rlog
       
   140   15 log entries
       
   141   creating changesets
       
   142   8 changeset entries
       
   143   sorting...
       
   144   converting...
       
   145   7 add file1 on trunk
       
   146   6 add file2
       
   147   5 add file3, file4 on branch v1_1
       
   148   4 MERGE from v1_0: add file2
       
   149   3 add file5 on v1_2
       
   150   2 add file6 on trunk post-v1_2
       
   151   1 MERGE from v1_2: add file5
       
   152   0 MERGE from HEAD: add file6
       
   153 
       
   154 hg glog output (#1)
       
   155 
       
   156   $ hg -R proj.hg glog --template "{rev} {desc}\n"
       
   157   o  7 MERGE from HEAD: add file6
       
   158   |
       
   159   | o  6 MERGE from v1_2: add file5
       
   160   | |
       
   161   | o  5 add file6 on trunk post-v1_2
       
   162   | |
       
   163   o |  4 add file5 on v1_2
       
   164   |/
       
   165   | o  3 MERGE from v1_0: add file2
       
   166   | |
       
   167   | o  2 add file3, file4 on branch v1_1
       
   168   |/
       
   169   | o  1 add file2
       
   170   |/
       
   171   o  0 add file1 on trunk
       
   172   
       
   173 
       
   174 convert to hg (#2: with merge detection)
       
   175 
       
   176   $ hg convert \
       
   177   >   --config convert.cvsps.mergefrom='"^MERGE from (\S+):"' \
       
   178   >   --datesort \
       
   179   >   proj proj.hg2
       
   180   initializing destination proj.hg2 repository
       
   181   connecting to */cvsrepo (glob)
       
   182   scanning source...
       
   183   collecting CVS rlog
       
   184   15 log entries
       
   185   creating changesets
       
   186   8 changeset entries
       
   187   sorting...
       
   188   converting...
       
   189   7 add file1 on trunk
       
   190   6 add file2
       
   191   5 add file3, file4 on branch v1_1
       
   192   4 MERGE from v1_0: add file2
       
   193   3 add file5 on v1_2
       
   194   2 add file6 on trunk post-v1_2
       
   195   1 MERGE from v1_2: add file5
       
   196   0 MERGE from HEAD: add file6
       
   197 
       
   198 hg glog output (#2)
       
   199 
       
   200   $ hg -R proj.hg2 glog --template "{rev} {desc}\n"
       
   201   o  7 MERGE from HEAD: add file6
       
   202   |
       
   203   | o  6 MERGE from v1_2: add file5
       
   204   | |
       
   205   | o  5 add file6 on trunk post-v1_2
       
   206   | |
       
   207   o |  4 add file5 on v1_2
       
   208   |/
       
   209   | o  3 MERGE from v1_0: add file2
       
   210   | |
       
   211   | o  2 add file3, file4 on branch v1_1
       
   212   |/
       
   213   | o  1 add file2
       
   214   |/
       
   215   o  0 add file1 on trunk
       
   216