tests/test-metaedit.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Tue, 05 Dec 2017 13:53:04 +0100
branchstable
changeset 3227 873d2f1949e1
parent 3208 c9e7b8db9900
child 3218 772cc931f085
child 3273 c0ee9ddfd5ff
permissions -rw-r--r--
topic: use more protective code to access current topic There are some code path where the operation is not properly initialized and lack the new attributes. While the lack of initialization, is suspicious and I've not be able to pin point case where this happens. Currently the code crash when it encounter this situation. So we make the code more resistant to this case to prevent bad user experience.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
2517
b78c2794e13f test: fix metaedit tests by forcing dates
Boris Feld <boris.feld@octobus.net>
parents: 2501
diff changeset
     2
  > [defaults]
b78c2794e13f test: fix metaedit tests by forcing dates
Boris Feld <boris.feld@octobus.net>
parents: 2501
diff changeset
     3
  > amend=-d "0 0"
b78c2794e13f test: fix metaedit tests by forcing dates
Boris Feld <boris.feld@octobus.net>
parents: 2501
diff changeset
     4
  > fold=-d "0 0"
b78c2794e13f test: fix metaedit tests by forcing dates
Boris Feld <boris.feld@octobus.net>
parents: 2501
diff changeset
     5
  > metaedit=-d "0 0"
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     6
  > [web]
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     7
  > push_ssl = false
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
     8
  > allow_push = *
113
3bdabdbb4140 adapt evolution to phase in core.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 94
diff changeset
     9
  > [phases]
3bdabdbb4140 adapt evolution to phase in core.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 94
diff changeset
    10
  > publish = False
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    11
  > [alias]
113
3bdabdbb4140 adapt evolution to phase in core.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 94
diff changeset
    12
  > qlog = log --template='{rev} - {node|short} {desc} ({phase})\n'
82
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    13
  > [diff]
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    14
  > git = 1
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    15
  > unified = 0
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    16
  > [extensions]
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    17
  > EOF
1806
9f42f819267b evolve: move the extensions to 'hgext3rd'
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 1785
diff changeset
    18
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    19
  $ mkcommit() {
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    20
  >    echo "$1" > "$1"
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    21
  >    hg add "$1"
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    22
  >    hg ci -m "$1"
81
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    23
  > }
5cec25ce019c Basic kill command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
    24
1358
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    25
  $ mkstack() {
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    26
  >    # Creates a stack of commit based on $1 with messages from $2, $3 ..
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    27
  >    hg update $1 -C
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    28
  >    shift
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    29
  >    mkcommits $*
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    30
  > }
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    31
296
c3ff47e6bd36 test-evolve: extend output and exhibit an amend bug
Patrick Mezard <patrick@mezard.eu>
parents: 269
diff changeset
    32
  $ glog() {
2776
4dd84054ebbb test: remove reference to the graphlog extension
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2769
diff changeset
    33
  >   hg log -G --template '{rev}:{node|short}@{branch}({phase}) {desc|firstline}\n' "$@"
296
c3ff47e6bd36 test-evolve: extend output and exhibit an amend bug
Patrick Mezard <patrick@mezard.eu>
parents: 269
diff changeset
    34
  > }
c3ff47e6bd36 test-evolve: extend output and exhibit an amend bug
Patrick Mezard <patrick@mezard.eu>
parents: 269
diff changeset
    35
1358
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    36
  $ shaof() {
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    37
  >   hg log -T {node} -r "first(desc($1))"
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    38
  > }
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    39
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    40
  $ mkcommits() {
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    41
  >   for i in $@; do mkcommit $i ; done
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    42
  > }
3f5db977d46f evolve: add a more complex test for evolve --rev
Laurent Charignon <lcharignon@fb.com>
parents: 1357
diff changeset
    43
82
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    44
##########################
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    45
importing Parren test
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    46
##########################
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    47
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    48
  $ cat << EOF >> $HGRCPATH
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    49
  > [ui]
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    50
  > logtemplate = "{rev}\t{bookmarks}: {desc|firstline} - {author|user}\n"
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    51
  > EOF
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    52
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    53
HG METAEDIT
82
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    54
===============================
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    55
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    56
Setup the Base Repo
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    57
-------------------
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    58
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    59
We start with a plain base repo::
8108d566a8b5 [evolution] imported hg amend from parren works
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 81
diff changeset
    60
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    61
  $ hg init $TESTTMP/metaedit; cd $TESTTMP/metaedit
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    62
  $ mkcommit "ROOT"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    63
  $ hg phase --public "desc(ROOT)"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    64
  $ mkcommit "A"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    65
  $ mkcommit "B"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    66
  $ hg up "desc(A)"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    67
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    68
  $ mkcommit "C"
137
bbc653876876 fix evolve test
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 116
diff changeset
    69
  created new head
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    70
  $ mkcommit "D"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    71
  $ echo "D'" > D
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    72
  $ hg amend -m "D2"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    73
  $ hg up "desc(C)"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    74
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    75
  $ mkcommit "E"
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    76
  created new head
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    77
  $ mkcommit "F"
196
dea67dae27a4 amend: add a warning after amend added unstablility
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 145
diff changeset
    78
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    79
Test
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    80
----
418
18a0d96ed559 evolve: graft --continue is optional, test
Patrick Mezard <patrick@mezard.eu>
parents: 414
diff changeset
    81
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    82
  $ hg log -G
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    83
  @  7	: F - test
933
e5baeb8fefec fold: add --message and --logfile options
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 915
diff changeset
    84
  |
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    85
  o  6	: E - test
1141
ca17770d2ee9 evolve: preserve branch change
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 1133
diff changeset
    86
  |
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
    87
  | o  5	: D2 - test
1325
1fe3da0b4601 evolve: add --rev option to the evolve command
Laurent Charignon <lcharignon@fb.com>
parents: 1283
diff changeset
    88
  |/
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    89
  o  3	: C - test
1325
1fe3da0b4601 evolve: add --rev option to the evolve command
Laurent Charignon <lcharignon@fb.com>
parents: 1283
diff changeset
    90
  |
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    91
  | o  2	: B - test
1325
1fe3da0b4601 evolve: add --rev option to the evolve command
Laurent Charignon <lcharignon@fb.com>
parents: 1283
diff changeset
    92
  |/
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    93
  o  1	: A - test
1325
1fe3da0b4601 evolve: add --rev option to the evolve command
Laurent Charignon <lcharignon@fb.com>
parents: 1283
diff changeset
    94
  |
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    95
  o  0	: ROOT - test
1441
a4abe588d77f evolve: mechanism to load some commands selectively
Laurent Charignon <lcharignon@fb.com>
parents: 1428
diff changeset
    96
  
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
    97
  $ hg update --clean .
1397
35f2f54b557c evolve: make prune respect allowunsable
Laurent Charignon <lcharignon@fb.com>
parents: 1370
diff changeset
    98
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
    99
  $ hg metaedit -r 0
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   100
  abort: cannot edit commit information for public revisions
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   101
  [255]
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   102
  $ hg metaedit --fold
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   103
  abort: revisions must be specified with --fold
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   104
  [255]
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   105
  $ hg metaedit -r 0 --fold
2780
58e4b51ee902 prefetc: point at the offending changeset when aborting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2779
diff changeset
   106
  abort: cannot fold public changesets: ea207398892e
2779
f51efb2bb8c9 precheck: point to 'phase' help when aborting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2778
diff changeset
   107
  (see 'hg help phases' for details)
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   108
  [255]
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   109
  $ hg metaedit 'desc(C) + desc(F)' --fold
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   110
  abort: cannot fold non-linear revisions (multiple roots given)
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   111
  [255]
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   112
  $ hg metaedit "desc(C)::desc(D2) + desc(E)" --fold
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   113
  abort: cannot fold non-linear revisions (multiple heads given)
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   114
  [255]
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   115
check that metaedit respects allowunstable
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   116
  $ hg metaedit '.^' --config 'experimental.evolution=createmarkers, allnewcommands'
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   117
  abort: cannot edit commit information in the middle of a stack
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   118
  (587528abfffe will become unstable and new unstable changes are not allowed)
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   119
  [255]
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   120
  $ hg metaedit 'desc(A)::desc(B)' --fold --config 'experimental.evolution=createmarkers, allnewcommands'
2784
d17d193c4145 precheck: update the orphan message to something me generic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2783
diff changeset
   121
  abort: fold will orphan 4 descendants
2783
3e9c3119410a precheck: point to the instability doc when aborting
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2780
diff changeset
   122
  (see 'hg help evolution.instability')
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   123
  [255]
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   124
  $ hg metaedit --user foobar
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   125
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   126
  $ hg log --template '{rev}: {author}\n' -r 'desc(F):' --hidden
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   127
  7: test
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   128
  8: foobar
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   129
  $ hg log --template '{rev}: {author}\n' -r .
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   130
  8: foobar
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   131
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   132
TODO: support this
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   133
  $ hg metaedit '.^::.'
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   134
  abort: editing multiple revisions without --fold is not currently supported
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   135
  [255]
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   136
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   137
  $ HGEDITOR=cat hg metaedit '.^::.' --fold
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   138
  HG: This is a fold of 2 changesets.
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   139
  HG: Commit message of changeset 6.
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   140
  
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   141
  E
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   142
  
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   143
  HG: Commit message of changeset 8.
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   144
  
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   145
  F
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   146
  
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   147
  
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   148
  
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   149
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   150
  HG: Leave message empty to abort commit.
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   151
  HG: --
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   152
  HG: user: test
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   153
  HG: branch 'default'
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   154
  HG: added E
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   155
  HG: added F
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   156
  2 changesets folded
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   157
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   158
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   159
  $ glog -r .
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   160
  @  9:a08d35fd7d9d@default(draft) E
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   161
  |
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   162
  ~
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   163
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   164
no new commit is created here because the date is the same
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   165
  $ HGEDITOR=cat hg metaedit
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   166
  E
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   167
  
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   168
  
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   169
  F
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   170
  
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   171
  
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   172
  HG: Enter commit message.  Lines beginning with 'HG:' are removed.
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   173
  HG: Leave message empty to abort commit.
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   174
  HG: --
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   175
  HG: user: test
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   176
  HG: branch 'default'
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   177
  HG: added E
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   178
  HG: added F
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   179
  nothing changed
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   180
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   181
  $ glog -r '.^::.'
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   182
  @  9:a08d35fd7d9d@default(draft) E
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   183
  |
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   184
  o  3:3260958f1169@default(draft) C
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   185
  |
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   186
  ~
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   187
2481
d63f383e43b6 test: fix test-evolve.t
Boris Feld <boris.feld@octobus.net>
parents: 2426
diff changeset
   188
TODO: don't create a new commit in this case, we should take the date of the
d63f383e43b6 test: fix test-evolve.t
Boris Feld <boris.feld@octobus.net>
parents: 2426
diff changeset
   189
old commit (we add a default date with a value to show that metaedit is taking
d63f383e43b6 test: fix test-evolve.t
Boris Feld <boris.feld@octobus.net>
parents: 2426
diff changeset
   190
the current date to generate the hash, this way we still have a stable hash
d63f383e43b6 test: fix test-evolve.t
Boris Feld <boris.feld@octobus.net>
parents: 2426
diff changeset
   191
but highlight the bug)
d63f383e43b6 test: fix test-evolve.t
Boris Feld <boris.feld@octobus.net>
parents: 2426
diff changeset
   192
  $ hg metaedit --config defaults.metaedit= --config devel.default-date="42 0"
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   193
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   194
  $ hg log -r '.^::.' --template '{rev}: {desc|firstline}\n'
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   195
  3: C
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   196
  10: E
1685
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   197
4fd0db2f6d84 commands: introduce a new command to edit commit metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1673
diff changeset
   198
  $ hg up .^
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   199
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   200
  $ hg metaedit --user foobar2 tip
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   201
  $ hg log --template '{rev}: {author}\n' -r "user(foobar):" --hidden
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   202
  8: foobar
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   203
  9: test
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   204
  10: test
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   205
  11: foobar2
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   206
  $ hg diff -r "10" -r "11" --hidden
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   207
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   208
'fold' one commit
3208
c9e7b8db9900 test: remove dangling --config in test-metaedit.t
Boris Feld <boris.feld@octobus.net>
parents: 3013
diff changeset
   209
  $ HGUSER=foobar3 hg metaedit "desc(D2)" --fold -U
1686
474db2d60202 metaedit: add support for folding commits while editing their metadata
Siddharth Agarwal <sid0@fb.com>
parents: 1685
diff changeset
   210
  1 changesets folded
2501
67be11064077 test: extract metaedit tests into test-metaedit.t test file
Boris Feld <boris.feld@octobus.net>
parents: 2483
diff changeset
   211
  $ hg log -r "tip" --template '{rev}: {author}\n'
3013
945a0989e41b packaging: merge stable back into default
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3000
diff changeset
   212
  12: foobar3