view tests/test-fold.t @ 2957:586c9ace20b3

obslog: simplify formatter keys The formatter field keys are all prefixed with `debugobshistory.'. This is annoyingly useless as they are already in the `debughistory` topic. This patch simplify these keys. For examle, on this repository `hg obslog -Tdebug -r 31cbace4c0f1` : ``` debugobshistory = [ { 'node':'31cbace4c0f1', 'shortdescription':'topics: make sure we have some restrictions on topic names', 'rev':2904, 'markers':[ ] }, { 'node':'d439a6087434', 'markers':[ { 'date':(1504176329.83902, -7200 ), 'verb':'rewritten', 'succnodes':[ '31cbace4c0f1' ], 'effect':[ 'parent' ], 'user':'Pierre-Yves David <pierre-yves.david@octobus.net>' } ] }, { 'node':'1e1f651704d4', 'markers':[ { 'date':(1504175088.811924, -7200 ), 'verb':'rewritten', 'succnodes':[ 'd439a6087434' ], 'effect':[ 'parent' ], 'user':'Pierre-Yves David <pierre-yves.david@octobus.net>' } ] }, { 'node':'eb6495cf6cb1', 'markers':[ { 'date':(1504015275.001643, -19800 ), 'verb':'rewritten', 'succnodes':[ '1e1f651704d4' ], 'effect':[ 'parent', 'content' ], 'user':'Pulkit Goyal <7895pulkit@gmail.com>' } ] }, { 'node':'761e446e0112', 'markers':[ { 'date':(1504015201.780276, -19800 ), 'verb':'rewritten', 'succnodes':[ 'eb6495cf6cb1' ], 'effect':[ 'content' ], 'user':'Pulkit Goyal <7895pulkit@gmail.com>' } ] }, { 'node':'531a626950bd', 'markers':[ { 'date':(1504015017.897054, -19800 ), 'verb':'rewritten', 'succnodes':[ '761e446e0112' ], 'effect':[ 'meta', 'parent', 'content' ], 'user':'Pulkit Goyal <7895pulkit@gmail.com>' } ] }, { 'node':'c2f9ba7329ea', 'markers':[ { 'date':(1504014136.876537, -19800 ), 'verb':'rewritten', 'succnodes':[ '531a626950bd' ], 'effect':[ 'meta' ], 'user':'Pulkit Goyal <7895pulkit@gmail.com>' } ] }, ] ``` We now able to ask `hg obslog -r 78debdfb3e4d -T '{label("log.summary", shortdescription)}\n{if(markers, markers % " {date|age} {user|person}\n")}'` ``` doc: simplify the reference to in-core features 9 days ago Pierre-Yves David 9 days ago Pierre-Yves David 9 days ago Pierre-Yves David 9 days ago Pierre-Yves David 9 days ago Philippe Pepiot 9 days ago Philippe Pepiot ```
author Alain Leufroy
date Fri, 08 Sep 2017 12:10:21 +0200
parents b5a48e4aeec6
children 1627153804dc a8596ac13fe8
line wrap: on
line source

  $ . $TESTDIR/testlib/common.sh

setup

  $ cat >> $HGRCPATH <<EOF
  > [defaults]
  > fold=-d "0 0"
  > [extensions]
  > evolve=
  > [ui]
  > logtemplate = '{rev} - {node|short} {desc|firstline} [{author}] ({phase})\n'
  > EOF

  $ hg init fold-tests
  $ cd fold-tests/
  $ hg debugbuilddag .+3:branchpoint+4*branchpoint+2
  $ hg up 'desc("r7")'
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg log -G
  o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
  |
  o  9 - 529dfc5bb875 r9 [debugbuilddag] (draft)
  |
  o  8 - abf57d94268b r8 [debugbuilddag] (draft)
  |
  | @  7 - 4de32a90b66c r7 [debugbuilddag] (draft)
  | |
  | o  6 - f69452c5b1af r6 [debugbuilddag] (draft)
  | |
  | o  5 - c8d03c1b5e94 r5 [debugbuilddag] (draft)
  | |
  | o  4 - bebd167eb94d r4 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (draft)
  

Test various error case

  $ hg fold --exact null::
  abort: cannot fold the null revision
  (no changeset checked out)
  [255]
  $ hg fold
  abort: no revisions specified
  [255]
  $ hg fold --from
  abort: no revisions specified
  [255]
  $ hg fold .
  abort: must specify either --from or --exact
  [255]
  $ hg fold --from . --exact
  abort: cannot use both --from and --exact
  [255]
  $ hg fold --from .
  single revision specified, nothing to fold
  [1]
  $ hg fold '0::(7+10)' --exact
  abort: cannot fold non-linear revisions (multiple heads given)
  [255]
  $ hg fold -r 4 -r 6 --exact
  abort: cannot fold non-linear revisions (multiple roots given)
  [255]
  $ hg fold --from 10 1
  abort: cannot fold non-linear revisions
  (given revisions are unrelated to parent of working directory)
  [255]
  $ hg fold --exact -r "4 and not 4"
  abort: specified revisions evaluate to an empty set
  (use different revision arguments)
  [255]
  $ hg phase --public 0
  $ hg fold --from -r 0
  abort: cannot fold public changesets: 1ea73414a91b
  (see 'hg help phases' for details)
  [255]

Test actual folding

  $ hg fold --from -r 'desc("r5")'
  3 changesets folded
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved

(test inherited from test-evolve.t)

  $ hg fold --from 6 # want to run hg fold 6
  abort: hidden revision '6'!
  (use --hidden to access hidden revisions; successor: 198b5c405d01)
  [255]

  $ hg log -G
  @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
  |
  | o  10 - a8407f9a3dc1 r10 [debugbuilddag] (draft)
  | |
  | o  9 - 529dfc5bb875 r9 [debugbuilddag] (draft)
  | |
  | o  8 - abf57d94268b r8 [debugbuilddag] (draft)
  | |
  o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
  

test fold --exact

  $ hg fold --exact 'desc("r8") + desc("r10")'
  abort: cannot fold non-linear revisions (multiple roots given)
  [255]
  $ hg fold --exact 'desc("r8")::desc("r10")'
  3 changesets folded
  $ hg log -G
  o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
  |
  | @  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
  | |
  | o  4 - bebd167eb94d r4 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
  

Test allow unstable

  $ echo a > a
  $ hg add a
  $ hg commit '-m r11'
  $ hg up '.^'
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
  $ hg log -G
  o  13 - 14d0e0da8e91 r11 [test] (draft)
  |
  | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
  | |
  @ |  11 - 198b5c405d01 r5 [debugbuilddag] (draft)
  | |
  o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
  

  $ cat << EOF >> .hg/hgrc
  > [experimental]
  > evolution = createmarkers, allnewcommands
  > EOF
  $ hg fold --from 'desc("r4")'
  abort: fold will orphan 1 descendants
  (see 'hg help evolution.instability')
  [255]
  $ hg fold --from 'desc("r3")::desc("r11")'
  abort: fold will orphan 1 descendants
  (see 'hg help evolution.instability')
  [255]

test --user variant

  $ cat << EOF >> .hg/hgrc
  > [experimental]
  > evolution = createmarkers, allnewcommands
  > EOF
  $ cat << EOF >> .hg/hgrc
  > [experimental]
  > evolution = all
  > EOF

  $ hg fold --exact 'desc("r5") + desc("r11")' --user 'Victor Rataxes <victor@rhino.savannah>'
  2 changesets folded
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg log -G
  @  14 - 29b470a33594 r5 [Victor Rataxes <victor@rhino.savannah>] (draft)
  |
  | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
  | |
  o |  4 - bebd167eb94d r4 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
  

  $ hg fold --from 'desc("r4")' -U
  2 changesets folded
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  $ hg log -G
  @  15 - 91880abed0f2 r4 [test] (draft)
  |
  | o  12 - b568edbee6e0 r8 [debugbuilddag] (draft)
  |/
  o  3 - 2dc09a01254d r3 [debugbuilddag] (draft)
  |
  o  2 - 01241442b3c2 r2 [debugbuilddag] (draft)
  |
  o  1 - 66f7d451a68b r1 [debugbuilddag] (draft)
  |
  o  0 - 1ea73414a91b r0 [debugbuilddag] (public)
  
  $ cd ..