tests/test-update-branches.t
branchstable
changeset 16491 bfe89d65d651
parent 14485 610873cf064a
child 17347 2da47de36b6f
equal deleted inserted replaced
16490:c8ee34917045 16491:bfe89d65d651
    13 # o  0:b608b9236435
    13 # o  0:b608b9236435
    14 
    14 
    15   $ hg init
    15   $ hg init
    16   $ echo foo > foo
    16   $ echo foo > foo
    17   $ echo zero > a
    17   $ echo zero > a
       
    18   $ hg init sub
       
    19   $ echo suba > sub/suba
       
    20   $ hg --cwd sub ci -Am addsuba
       
    21   adding suba
       
    22   $ echo 'sub = sub' > .hgsub
    18   $ hg ci -qAm0
    23   $ hg ci -qAm0
    19   $ echo one > a ; hg ci -m1
    24   $ echo one > a ; hg ci -m1
    20   $ echo two > a ; hg ci -m2
    25   $ echo two > a ; hg ci -m2
    21   $ hg up -q 1
    26   $ hg up -q 1
    22   $ echo three > a ; hg ci -qm3
    27   $ echo three > a ; hg ci -qm3
    27 
    32 
    28 Initial repo state:
    33 Initial repo state:
    29 
    34 
    30   $ hg --config 'extensions.graphlog=' \
    35   $ hg --config 'extensions.graphlog=' \
    31   >    glog --template '{rev}:{node|short} {parents} {branches}\n'
    36   >    glog --template '{rev}:{node|short} {parents} {branches}\n'
    32   @  5:e1bb631146ca  b1
    37   @  5:ff252e8273df  b1
    33   |
    38   |
    34   o  4:a4fdb3b883c4 0:b608b9236435  b1
    39   o  4:d047485b3896 0:60829823a42a  b1
    35   |
    40   |
    36   | o  3:4b57d2520816 1:44592833ba9f
    41   | o  3:6efa171f091b 1:0786582aa4b1
    37   | |
    42   | |
    38   | | o  2:063f31070f65
    43   | | o  2:bd10386d478c
    39   | |/
    44   | |/
    40   | o  1:44592833ba9f
    45   | o  1:0786582aa4b1
    41   |/
    46   |/
    42   o  0:b608b9236435
    47   o  0:60829823a42a
    43   
    48   
    44 
    49 
    45 Test helper functions:
    50 Test helper functions:
    46 
    51 
    47   $ revtest () {
    52   $ revtest () {
    48   >     msg=$1
    53   >     msg=$1
    49   >     dirtyflag=$2   # 'clean' or 'dirty'
    54   >     dirtyflag=$2   # 'clean', 'dirty' or 'dirtysub'
    50   >     startrev=$3
    55   >     startrev=$3
    51   >     targetrev=$4
    56   >     targetrev=$4
    52   >     opt=$5
    57   >     opt=$5
    53   >     hg up -qC $startrev
    58   >     hg up -qC $startrev
    54   >     test $dirtyflag = dirty && echo dirty > foo
    59   >     test $dirtyflag = dirty && echo dirty > foo
       
    60   >     test $dirtyflag = dirtysub && echo dirty > sub/suba
    55   >     hg up $opt $targetrev
    61   >     hg up $opt $targetrev
    56   >     hg parent --template 'parent={rev}\n'
    62   >     hg parent --template 'parent={rev}\n'
    57   >     hg stat
    63   >     hg stat -S
    58   > }    
    64   > }    
    59 
    65 
    60   $ norevtest () {
    66   $ norevtest () {
    61   >     msg=$1
    67   >     msg=$1
    62   >     dirtyflag=$2   # 'clean' or 'dirty'
    68   >     dirtyflag=$2   # 'clean', 'dirty' or 'dirtysub'
    63   >     startrev=$3
    69   >     startrev=$3
    64   >     opt=$4
    70   >     opt=$4
    65   >     hg up -qC $startrev
    71   >     hg up -qC $startrev
    66   >     test $dirtyflag = dirty && echo dirty > foo
    72   >     test $dirtyflag = dirty && echo dirty > foo
       
    73   >     test $dirtyflag = dirtysub && echo dirty > sub/suba
    67   >     hg up $opt
    74   >     hg up $opt
    68   >     hg parent --template 'parent={rev}\n'
    75   >     hg parent --template 'parent={rev}\n'
    69   >     hg stat
    76   >     hg stat -S
    70   > }    
    77   > }    
    71 
    78 
    72 Test cases are documented in a table in the update function of merge.py.
    79 Test cases are documented in a table in the update function of merge.py.
    73 Cases are run as shown in that table, row by row.
    80 Cases are run as shown in that table, row by row.
    74 
    81 
    97   $ revtest 'none dirty linear' dirty 1 2
   104   $ revtest 'none dirty linear' dirty 1 2
    98   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   105   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    99   parent=2
   106   parent=2
   100   M foo
   107   M foo
   101 
   108 
       
   109   $ revtest 'none dirtysub linear' dirtysub 1 2
       
   110   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   111   parent=2
       
   112   M sub/suba
       
   113 
   102   $ revtest 'none dirty same'   dirty 2 3
   114   $ revtest 'none dirty same'   dirty 2 3
   103   abort: crosses branches (merge branches or use --clean to discard changes)
   115   abort: crosses branches (merge branches or use --clean to discard changes)
   104   parent=2
   116   parent=2
   105   M foo
   117   M foo
       
   118 
       
   119   $ revtest 'none dirtysub same'   dirtysub 2 3
       
   120   abort: crosses branches (merge branches or use --clean to discard changes)
       
   121   parent=2
       
   122   M sub/suba
   106 
   123 
   107   $ revtest 'none dirty cross'  dirty 3 4
   124   $ revtest 'none dirty cross'  dirty 3 4
   108   abort: crosses branches (merge branches or use --clean to discard changes)
   125   abort: crosses branches (merge branches or use --clean to discard changes)
   109   parent=3
   126   parent=3
   110   M foo
   127   M foo
   111 
   128 
       
   129   $ revtest 'none dirtysub cross'  dirtysub 3 4
       
   130   abort: crosses branches (merge branches or use --clean to discard changes)
       
   131   parent=3
       
   132   M sub/suba
   112 
   133 
   113   $ revtest '-C dirty linear'   dirty 1 2 -C
   134   $ revtest '-C dirty linear'   dirty 1 2 -C
   114   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   135   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   115   parent=2
   136   parent=2
   116 
   137 
   117   $ revtest '-c dirty linear'   dirty 1 2 -c
   138   $ revtest '-c dirty linear'   dirty 1 2 -c
   118   abort: uncommitted local changes
   139   abort: uncommitted local changes
   119   parent=1
   140   parent=1
   120   M foo
   141   M foo
   121 
   142 
       
   143   $ revtest '-c dirtysub linear'   dirtysub 1 2 -c
       
   144   abort: uncommitted local changes
       
   145   parent=1
       
   146   M sub/suba
       
   147 
   122   $ norevtest '-c clean same'   clean 2 -c
   148   $ norevtest '-c clean same'   clean 2 -c
   123   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   149   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   124   parent=3
   150   parent=3
   125 
   151 
   126   $ revtest '-cC dirty linear'  dirty 1 2 -cC
   152   $ revtest '-cC dirty linear'  dirty 1 2 -cC