tests/test-merge-types.t
changeset 18337 557c8522aec0
parent 18334 44bda93df90e
child 18338 384df4db6520
equal deleted inserted replaced
18336:77973b6a7b0b 18337:557c8522aec0
     1   $ "$TESTDIR/hghave" symlink execbit || exit 80
     1   $ "$TESTDIR/hghave" symlink execbit || exit 80
     2 
     2 
     3   $ hg init
     3   $ tellmeabout() {
       
     4   > if [ -h $1 ]; then
       
     5   >     echo $1 is a symlink:
       
     6   >     $TESTDIR/readlink.py $1
       
     7   > elif [ -x $1 ]; then
       
     8   >     echo $1 is an executable file with content:
       
     9   >     cat $1
       
    10   > else
       
    11   >     echo $1 is a plain file with content:
       
    12   >     cat $1
       
    13   > fi
       
    14   > }
       
    15 
       
    16   $ hg init test1
       
    17   $ cd test1
     4 
    18 
     5   $ echo a > a
    19   $ echo a > a
     6   $ hg ci -Amadd
    20   $ hg ci -Aqmadd
     7   adding a
       
     8 
       
     9   $ chmod +x a
    21   $ chmod +x a
    10   $ hg ci -mexecutable
    22   $ hg ci -mexecutable
    11 
    23 
    12   $ hg up 0
    24   $ hg up -q 0
    13   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    14   $ rm a
    25   $ rm a
    15   $ ln -s symlink a
    26   $ ln -s symlink a
    16   $ hg ci -msymlink
    27   $ hg ci -msymlink
    17   created new head
    28   created new head
       
    29 
       
    30 Symlink is local parent, executable is other:
    18 
    31 
    19   $ hg merge --debug
    32   $ hg merge --debug
    20     searching for copies back to rev 1
    33     searching for copies back to rev 1
    21   resolving manifests
    34   resolving manifests
    22    overwrite: False, partial: False
    35    overwrite: False, partial: False
    26    a: update permissions -> e
    39    a: update permissions -> e
    27   updating: a 1/1 files (100.00%)
    40   updating: a 1/1 files (100.00%)
    28   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    41   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    29   (branch merge, don't forget to commit)
    42   (branch merge, don't forget to commit)
    30 
    43 
    31 
    44   $ tellmeabout a
    32 Symlink is local parent, executable is other:
    45   a is a plain file with content:
    33 
    46   symlink (no-eol)
    34   $ if [ -h a ]; then
    47 
    35   >     echo a is a symlink
    48 Symlink is other parent, executable is local:
    36   >     $TESTDIR/readlink.py a
       
    37   > elif [ -x a ]; then
       
    38   >     echo a is executable
       
    39   > else
       
    40   >     echo "a has no flags (default for conflicts)"
       
    41   > fi
       
    42   a has no flags (default for conflicts)
       
    43 
    49 
    44   $ hg update -C 1
    50   $ hg update -C 1
    45   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    51   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    46 
    52 
    47   $ hg merge --debug
    53   $ hg merge --debug
    55   updating: a 1/1 files (100.00%)
    61   updating: a 1/1 files (100.00%)
    56   getting a
    62   getting a
    57   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    63   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    58   (branch merge, don't forget to commit)
    64   (branch merge, don't forget to commit)
    59 
    65 
    60 
    66   $ tellmeabout a
    61 Symlink is other parent, executable is local:
    67   a is a plain file with content:
    62 
    68   symlink (no-eol)
    63   $ if [ -h a ]; then
       
    64   >    echo a is a symlink
       
    65   >    $TESTDIR/readlink.py a
       
    66   > elif [ -x a ]; then
       
    67   >     echo a is executable
       
    68   > else
       
    69   >     echo "a has no flags (default for conflicts)"
       
    70   > fi
       
    71   a has no flags (default for conflicts)
       
    72 
    69 
    73 Update to link without local change should get us a symlink (issue3316):
    70 Update to link without local change should get us a symlink (issue3316):
    74 
    71 
    75   $ hg up -C 0
    72   $ hg up -C 0
    76   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    73   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    78   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    75   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    79   $ hg st
    76   $ hg st
    80 
    77 
    81 Update to link with local change should cause a merge prompt (issue3200):
    78 Update to link with local change should cause a merge prompt (issue3200):
    82 
    79 
    83   $ hg up -C 0
    80   $ hg up -Cq 0
    84   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
    85   $ echo data > a
    81   $ echo data > a
    86   $ HGMERGE= hg up -y --debug
    82   $ HGMERGE= hg up -y --debug
    87     searching for copies back to rev 2
    83     searching for copies back to rev 2
    88   resolving manifests
    84   resolving manifests
    89    overwrite: False, partial: False
    85    overwrite: False, partial: False
   106   -symlink
   102   -symlink
   107   \ No newline at end of file
   103   \ No newline at end of file
   108   +data
   104   +data
   109 
   105 
   110 
   106 
       
   107 Test only 'l' change - happens rarely, except when recovering from situations
       
   108 where that was what happened.
       
   109 
       
   110   $ hg init test2
       
   111   $ cd test2
       
   112   $ printf base > f
       
   113   $ hg ci -Aqm0
       
   114   $ echo file > f
       
   115   $ echo content >> f
       
   116   $ hg ci -qm1
       
   117   $ hg up -qr0
       
   118   $ rm f
       
   119   $ ln -s base f
       
   120   $ hg ci -qm2
       
   121   $ hg merge
       
   122   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   123   (branch merge, don't forget to commit)
       
   124   $ tellmeabout f
       
   125   f is a symlink:
       
   126   f -> file
       
   127   content
       
   128   
       
   129 
       
   130   $ hg up -Cqr1
       
   131   $ hg merge
       
   132   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   133   (branch merge, don't forget to commit)
       
   134   $ tellmeabout f
       
   135   f is a plain file with content:
       
   136   file
       
   137   content
       
   138 
       
   139   $ cd ..
       
   140 
       
   141 Test removed 'x' flag merged with change to symlink
       
   142 
       
   143   $ hg init test3
       
   144   $ cd test3
       
   145   $ echo f > f
       
   146   $ chmod +x f
       
   147   $ hg ci -Aqm0
       
   148   $ chmod -x f
       
   149   $ hg ci -qm1
       
   150   $ hg up -qr0
       
   151   $ rm f
       
   152   $ ln -s dangling f
       
   153   $ hg ci -qm2
       
   154   $ hg merge
       
   155   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   156   (branch merge, don't forget to commit)
       
   157   $ tellmeabout f
       
   158   f is a symlink:
       
   159   f -> dangling
       
   160 
       
   161   $ hg up -Cqr1
       
   162   $ hg merge
       
   163   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   164   (branch merge, don't forget to commit)
       
   165   $ tellmeabout f
       
   166   f is a symlink:
       
   167   f -> dangling
       
   168 
       
   169   $ cd ..
       
   170 
       
   171 Test merge with no common ancestor:
       
   172 a: just different
       
   173 b: x vs -, different (cannot calculate x, cannot ask merge tool)
       
   174 c: x vs -, same (cannot calculate x, merge tool is no good)
       
   175 d: x vs l, different
       
   176 e: x vs l, same
       
   177 f: - vs l, different
       
   178 g: - vs l, same
       
   179 h: l vs l, different
       
   180 (where same means the filelog entry is shared and there thus is an ancestor!)
       
   181 
       
   182   $ hg init test4
       
   183   $ cd test4
       
   184   $ echo 0 > 0
       
   185   $ hg ci -Aqm0
       
   186 
       
   187   $ echo 1 > a
       
   188   $ echo 1 > b
       
   189   $ chmod +x b
       
   190   $ echo x > c
       
   191   $ chmod +x c
       
   192   $ echo 1 > d
       
   193   $ chmod +x d
       
   194   $ printf x > e
       
   195   $ chmod +x e
       
   196   $ echo 1 > f
       
   197   $ printf x > g
       
   198   $ ln -s 1 h
       
   199   $ hg ci -qAm1
       
   200 
       
   201   $ hg up -qr0
       
   202   $ echo 2 > a
       
   203   $ echo 2 > b
       
   204   $ echo x > c
       
   205   $ ln -s 2 d
       
   206   $ ln -s x e
       
   207   $ ln -s 2 f
       
   208   $ ln -s x g
       
   209   $ ln -s 2 h
       
   210   $ hg ci -Aqm2
       
   211 
       
   212   $ hg merge
       
   213    conflicting flags for e
       
   214   (n)one, e(x)ec or sym(l)ink? n
       
   215    conflicting flags for d
       
   216   (n)one, e(x)ec or sym(l)ink? n
       
   217   merging a
       
   218   warning: conflicts during merge.
       
   219   merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   220   merging b
       
   221   warning: conflicts during merge.
       
   222   merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   223   merging d
       
   224   warning: internal:merge cannot merge symlinks for d
       
   225   merging d incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   226   merging f
       
   227   warning: internal:merge cannot merge symlinks for f
       
   228   merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   229   merging h
       
   230   warning: internal:merge cannot merge symlinks for h
       
   231   merging h incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   232   2 files updated, 0 files merged, 0 files removed, 5 files unresolved
       
   233   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
       
   234   [1]
       
   235   $ hg resolve -l
       
   236   U a
       
   237   U b
       
   238   U d
       
   239   U f
       
   240   U h
       
   241   $ tellmeabout a
       
   242   a is a plain file with content:
       
   243   <<<<<<< local
       
   244   2
       
   245   =======
       
   246   1
       
   247   >>>>>>> other
       
   248   $ tellmeabout b
       
   249   b is an executable file with content:
       
   250   <<<<<<< local
       
   251   2
       
   252   =======
       
   253   1
       
   254   >>>>>>> other
       
   255   $ tellmeabout c
       
   256   c is an executable file with content:
       
   257   x
       
   258   $ tellmeabout d
       
   259   d is a plain file with content:
       
   260   2 (no-eol)
       
   261   $ tellmeabout e
       
   262   e is a plain file with content:
       
   263   x (no-eol)
       
   264   $ tellmeabout f
       
   265   f is a symlink:
       
   266   f -> 2
       
   267   $ tellmeabout g
       
   268   g is a symlink:
       
   269   g -> x
       
   270   $ tellmeabout h
       
   271   h is a symlink:
       
   272   h -> 2
       
   273 
       
   274   $ hg up -Cqr1
       
   275   $ hg merge
       
   276    conflicting flags for e
       
   277   (n)one, e(x)ec or sym(l)ink? n
       
   278    conflicting flags for d
       
   279   (n)one, e(x)ec or sym(l)ink? n
       
   280   merging a
       
   281   warning: conflicts during merge.
       
   282   merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   283   merging b
       
   284   warning: conflicts during merge.
       
   285   merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   286   merging d
       
   287   warning: internal:merge cannot merge symlinks for d
       
   288   merging d incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   289   merging f
       
   290   warning: internal:merge cannot merge symlinks for f
       
   291   merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   292   merging h
       
   293   warning: internal:merge cannot merge symlinks for h
       
   294   merging h incomplete! (edit conflicts, then use 'hg resolve --mark')
       
   295   1 files updated, 0 files merged, 0 files removed, 5 files unresolved
       
   296   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
       
   297   [1]
       
   298   $ tellmeabout a
       
   299   a is a plain file with content:
       
   300   <<<<<<< local
       
   301   1
       
   302   =======
       
   303   2
       
   304   >>>>>>> other
       
   305   $ tellmeabout b
       
   306   b is an executable file with content:
       
   307   <<<<<<< local
       
   308   1
       
   309   =======
       
   310   2
       
   311   >>>>>>> other
       
   312   $ tellmeabout c
       
   313   c is an executable file with content:
       
   314   x
       
   315   $ tellmeabout d
       
   316   d is a plain file with content:
       
   317   1
       
   318   $ tellmeabout e
       
   319   e is a plain file with content:
       
   320   x (no-eol)
       
   321   $ tellmeabout f
       
   322   f is a plain file with content:
       
   323   1
       
   324   $ tellmeabout g
       
   325   g is a plain file with content:
       
   326   x (no-eol)
       
   327   $ tellmeabout h
       
   328   h is a symlink:
       
   329   h -> 1
       
   330 
       
   331   $ cd ..