tests/test-touch.t
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
Tue, 02 May 2017 02:13:33 +0200
changeset 2300 01efebff13ec
parent 2289 61d073590fb7
child 2854 66796d7b5415
permissions -rw-r--r--
obscache: skip the cache entirely if not up to date The current update code has some race condition windows around updating. But we also ensure the cache are up to date with every transaction. So outdated cache mean another client have been mudding the repository but things will get back in place at the next transaction. So we just skip using the cache when not up to date. This is not the best we could do. But this is good enough for now.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
700
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     2
  $ cat >> $HGRCPATH <<EOF
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     3
  > [ui]
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     4
  > logtemplate={rev}:{node|short} {desc}\n
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     5
  > [defaults]
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
  > amend=-d "0 0"
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     7
  > [extensions]
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
  > hgext.rebase=
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     9
  > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1756
diff changeset
    10
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
700
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    11
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    12
  $ hg init repo
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    13
  $ cd repo
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    14
  $ echo A > a
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    15
  $ hg add a
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
  $ hg commit -m a
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    18
Basic usage
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
  $ hg log -G
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
  @  0:e93df3427f45 a
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    22
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
  $ hg touch .
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
  $ hg log -G
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    25
  @  1:[0-9a-f]{12} a (re)
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    26
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    27
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    28
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    29
Revive usage
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    30
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    31
  $ echo A > b
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    32
  $ hg add b
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    33
  $ hg commit -m ab --amend
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    34
  $ hg up --hidden 1
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    35
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
    36
  working directory parent is obsolete! (*) (glob)
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents: 1806
diff changeset
    37
  (use 'hg evolve' to update to its successor: *) (glob)
700
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    38
  $ hg log -G
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    39
  o  3:[0-9a-f]{12} ab (re)
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    40
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    41
  @  1:[0-9a-f]{12} a (re)
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    42
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    43
  $ hg touch .
1589
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
    44
  [1] a
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
    45
  reviving this changeset will create divergence unless you make a duplicate.
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
    46
  (a)llow divergence or (d)uplicate the changeset?  a
700
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    47
  2 new divergent changesets
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    48
  $ hg log -G
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    49
  @  4:[0-9a-f]{12} a (re)
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    50
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    51
  o  3:[0-9a-f]{12} ab (re)
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    52
  
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    53
  $ hg prune 3
ebcfd72e7609 touch: add basic testing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    54
  1 changesets pruned
701
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    55
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    56
Duplicate
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    57
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    58
  $ hg touch --duplicate .
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    59
  $ hg log -G
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    60
  @  5:[0-9a-f]{12} a (re)
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    61
  
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    62
  o  4:[0-9a-f]{12} a (re)
f752089479ce add a duplicate option in touch
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 700
diff changeset
    63
  
702
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    64
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    65
Multiple touch
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    66
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    67
  $ echo C > c
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    68
  $ hg add c
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    69
  $ hg commit -m c
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    70
  $ echo D > d
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    71
  $ hg add d
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    72
  $ hg commit -m d
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    73
  $ hg log -G
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    74
  @  7:[0-9a-f]{12} d (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    75
  |
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    76
  o  6:[0-9a-f]{12} c (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    77
  |
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    78
  o  5:[0-9a-f]{12} a (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    79
  
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    80
  o  4:[0-9a-f]{12} a (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    81
  
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    82
  $ hg touch 6:7
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    83
  $ hg log -G
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    84
  @  9:[0-9a-f]{12} d (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    85
  |
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    86
  o  8:[0-9a-f]{12} c (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    87
  |
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    88
  o  5:[0-9a-f]{12} a (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    89
  
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    90
  o  4:[0-9a-f]{12} a (re)
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    91
  
b5a85a8909d3 touch: properly handle touching multiple changeset
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 701
diff changeset
    92
1151
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    93
check move data kept after rebase on touch:
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    94
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    95
  $ touch gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    96
  $ hg commit -Am gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    97
  adding gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    98
  $ hg mv gna1 gna2
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
    99
  $ hg commit -m move
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   100
  $ hg st -C --change=tip
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   101
  A gna2
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   102
    gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   103
  R gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   104
  $ hg up .^
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   105
  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   106
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   107
  $ hg touch
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   108
  1 new unstable changesets
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   109
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   110
  $ hg rebase -s 11 -d 12
1188
0c879e986ce4 test: adapt to core change in graft and rebase
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1151
diff changeset
   111
  rebasing 11:* "move" (glob)
1151
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   112
  $ hg st -C --change=tip
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   113
  A gna2
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   114
    gna1
802a87359017 test-touch: add a test for rename preservation after touch
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 743
diff changeset
   115
  R gna1
1589
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   116
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   117
check that the --duplicate option does not create divergence
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   118
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   119
  $ hg touch --duplicate 11 --hidden
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   120
  1 new unstable changesets
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   121
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   122
check that reviving a changeset with no successor does not show the prompt
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   123
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   124
  $ hg prune 14
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   125
  1 changesets pruned
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   126
  $ hg touch 14 --hidden
d6630a6bff86 touch: prompt the user for what to do with the revived changeset
Laurent Charignon <lcharignon@fb.com>
parents: 1443
diff changeset
   127
  1 new unstable changesets