tests/test-evolve-obshistory-prune.t
author Joerg Sonnenberger <joerg@bec.de>
Thu, 09 Apr 2020 19:52:30 +0200
changeset 5319 6a4a65edecdc
parent 5173 dbbb48d93f18
child 5339 258c0a99c5b0
permissions -rw-r--r--
tests: avoid non-portable sed command sed -i is a GNU extension and the i command without newline as well. Just create the file from scratch with printf to side-step the issue.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
This test file test the various messages when accessing obsolete
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
revisions.
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
Global setup
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
============
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
3885
3df8b6ecce2a tests: extract obshistory setup in a separate file
Boris Feld <boris.feld@octobus.net>
parents: 3884
diff changeset
     7
  $ . $TESTDIR/testlib/obshistory_setup.sh
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     9
Test output with pruned commit
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    10
==============================
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    11
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
    12
Check output on the client side
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
    13
-------------------------------
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    14
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    15
  $ hg init $TESTTMP/local-prune
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
    16
  $ hg init $TESTTMP/server
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    17
  $ cd $TESTTMP/local-prune
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    18
  $ mkcommit ROOT
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    19
  $ mkcommit A0 # 0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    20
  $ mkcommit B0 # 1
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
    21
  $ sync
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    22
  $ hg log --hidden -G
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    23
  @  changeset:   2:0dec01379d3b
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    24
  |  tag:         tip
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    25
  |  user:        test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    26
  |  date:        Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    27
  |  summary:     B0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    28
  |
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    29
  o  changeset:   1:471f378eab4c
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    30
  |  user:        test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    31
  |  date:        Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    32
  |  summary:     A0
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    33
  |
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    34
  o  changeset:   0:ea207398892e
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    35
     user:        test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    36
     date:        Thu Jan 01 00:00:00 1970 +0000
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    37
     summary:     ROOT
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    38
  
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    39
  $ hg prune -r 'desc(B0)'
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    40
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
4613
30a544904238 messages: standardize on "working copy is now at" including "is"
Martin von Zweigbergk <martinvonz@google.com>
parents: 3895
diff changeset
    41
  working directory is now at 471f378eab4c
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    42
  1 changesets pruned
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
    43
  $ sync
2336
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    44
  $ hg log --hidden -G
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    45
  x  changeset:   2:0dec01379d3b
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    46
  |  tag:         tip
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    47
  |  user:        test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    48
  |  date:        Thu Jan 01 00:00:00 1970 +0000
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3564
diff changeset
    49
  |  obsolete:    pruned using prune
2336
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    50
  |  summary:     B0
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    51
  |
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    52
  @  changeset:   1:471f378eab4c
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    53
  |  user:        test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    54
  |  date:        Thu Jan 01 00:00:00 1970 +0000
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    55
  |  summary:     A0
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    56
  |
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    57
  o  changeset:   0:ea207398892e
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    58
     user:        test
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    59
     date:        Thu Jan 01 00:00:00 1970 +0000
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    60
     summary:     ROOT
93a37e13424f obshistory: add a debugobshistory command to show obs history of a revs
Boris Feld <boris.feld@octobus.net>
parents: 2290
diff changeset
    61
  
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    62
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    63
Actual test
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    64
-----------
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    65
2637
49f2741c4dd7 obslog: add a patch option
Boris Feld <boris.feld@octobus.net>
parents: 2585
diff changeset
    66
  $ hg obslog 'desc(B0)' --hidden --patch
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
    67
  x  0dec01379d3b (2) B0
3566
e6bea259c227 prune: include "operation" metadata in obsmarkers
Martin von Zweigbergk <martinvonz@google.com>
parents: 3564
diff changeset
    68
       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
3055
774b4ea6ca58 obslog: remove the word "yet" from "No patch available yet"
Pulkit Goyal <7895pulkit@gmail.com>
parents: 3054
diff changeset
    69
         (No patch available, no successors)
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
    70
  
2477
d7f7e8f3b51c test: rename all olog references
Boris Feld <boris.feld@octobus.net>
parents: 2476
diff changeset
    71
  $ hg obslog 'desc(B0)' --hidden --no-graph -Tjson | python -m json.tool
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    72
  [
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    73
      {
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
    74
          "markers": [
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    75
              {
5171
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
    76
                  "dates": [
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
    77
                      [
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
    78
                          *, (glob)
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
    79
                          0
7f7f40cc6c9b obslog: make date template property into dates
Anton Shestakov <av6@dwimlabs.net>
parents: 5169
diff changeset
    80
                      ]
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    81
                  ],
5169
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
    82
                  "operations": [
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
    83
                      "prune"
897b371cd0c5 obslog: make operation template property into operations
Anton Shestakov <av6@dwimlabs.net>
parents: 5168
diff changeset
    84
                  ],
5168
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
    85
                  "users": [
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
    86
                      "test"
c7ca43bba6c5 obslog: make user template property into users
Anton Shestakov <av6@dwimlabs.net>
parents: 5125
diff changeset
    87
                  ],
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
    88
                  "verb": "pruned"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    89
              }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    90
          ],
4983
6d40e0166522 obslog: make {node} the full node and leave shortening to template
Martin von Zweigbergk <martinvonz@google.com>
parents: 4918
diff changeset
    91
          "node": "0dec01379d3be6318c470ead31b1fe7ae7cb53d5",
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
    92
          "shortdescription": "B0"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    93
      }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    94
  ]
2637
49f2741c4dd7 obslog: add a patch option
Boris Feld <boris.feld@octobus.net>
parents: 2585
diff changeset
    95
  $ hg obslog 'desc(A0)' --patch
2407
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
    96
  @  471f378eab4c (1) A0
783a74c60a5e obshistory: add a graph option on the debugobshistory command
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2404
diff changeset
    97
  
2477
d7f7e8f3b51c test: rename all olog references
Boris Feld <boris.feld@octobus.net>
parents: 2476
diff changeset
    98
  $ hg obslog 'desc(A0)' --no-graph -Tjson | python -m json.tool
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
    99
  [
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
   100
      {
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
   101
          "markers": [],
4983
6d40e0166522 obslog: make {node} the full node and leave shortening to template
Martin von Zweigbergk <martinvonz@google.com>
parents: 4918
diff changeset
   102
          "node": "471f378eab4c5e25f6c77f785b27c936efb22874",
2957
586c9ace20b3 obslog: simplify formatter keys
Alain Leufroy
parents: 2956
diff changeset
   103
          "shortdescription": "A0"
2342
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
   104
      }
e28026b4d3c1 obshistory: use formatter instead of ui.write in the debugobshistory command
Boris Feld <boris.feld@octobus.net>
parents: 2336
diff changeset
   105
  ]
2290
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
   106
  $ hg up 1
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
   107
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
   108
  $ hg up 0dec01379d3b
3663
54a469cd5b26 test: update output to match upstream
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3567
diff changeset
   109
  abort: hidden revision '0dec01379d3b' is pruned!
54a469cd5b26 test: update output to match upstream
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3567
diff changeset
   110
  (use --hidden to access hidden revisions)
2290
a36a8c6a09ac ui: change the hidden revision error message
Boris Feld <boris.feld@octobus.net>
parents: 2289
diff changeset
   111
  [255]
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   112
  $ hg up --hidden -r 'desc(B0)'
3747
1e103c7f7663 test: update to new outputs
Boris Feld <boris.feld@octobus.net>
parents: 3730
diff changeset
   113
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1e103c7f7663 test: update to new outputs
Boris Feld <boris.feld@octobus.net>
parents: 3730
diff changeset
   114
  updated to hidden changeset 0dec01379d3b
3432
f57be161f34b test: update with new 'update' hint about obsfate
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3417
diff changeset
   115
  (hidden revision '0dec01379d3b' is pruned)
2289
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   116
  working directory parent is obsolete! (0dec01379d3b)
61d073590fb7 ui: add better messages when the working copy become obsolete.
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
   117
  (use 'hg evolve' to update to its parent successor)
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   118
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   119
Check output on the server side
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   120
-------------------------------
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   121
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   122
  $ hg obslog -f -R $TESTTMP/server --patch 0dec01379d3b --hidden
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   123
  x  0dec01379d3b (2) B0
5173
dbbb48d93f18 obslog: remove the separate "obslog -f" implementation and use the common one
Anton Shestakov <av6@dwimlabs.net>
parents: 5171
diff changeset
   124
       pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000)
3895
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   125
         (No patch available, no successors)
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   126
  
8c368720f010 obslog: check filtered output with pruned changesets
Boris Feld <boris.feld@octobus.net>
parents: 3887
diff changeset
   127
# TODO ADD amend + prune