view tests/test-evolve-obshistory-amend.t @ 3886:8f27e17c3558

tests: extract the obshistory amend test case into a separate file
author Boris Feld <boris.feld@octobus.net>
date Tue, 22 May 2018 15:40:29 +0200
parents tests/test-evolve-obshistory.t@3df8b6ecce2a
children 7c624b45fe60
line wrap: on
line source

This test file test the various messages when accessing obsolete
revisions.

Global setup
============

  $ . $TESTDIR/testlib/obshistory_setup.sh


Test output on amended commit
=============================

Test setup
----------

  $ hg init $TESTTMP/local-amend
  $ cd $TESTTMP/local-amend
  $ mkcommit ROOT
  $ mkcommit A0
  $ echo 42 >> A0
  $ hg amend -m "A1
  > 
  > Better commit message"
  $ hg log --hidden -G
  @  changeset:   2:4ae3a4151de9
  |  tag:         tip
  |  parent:      0:ea207398892e
  |  user:        test
  |  date:        Thu Jan 01 00:00:00 1970 +0000
  |  summary:     A1
  |
  | x  changeset:   1:471f378eab4c
  |/   user:        test
  |    date:        Thu Jan 01 00:00:00 1970 +0000
  |    obsolete:    rewritten using amend as 2:4ae3a4151de9
  |    summary:     A0
  |
  o  changeset:   0:ea207398892e
     user:        test
     date:        Thu Jan 01 00:00:00 1970 +0000
     summary:     ROOT
  
Actual test
-----------
  $ hg obslog --patch 4ae3a4151de9
  @  4ae3a4151de9 (2) A1
  |
  x  471f378eab4c (1) A0
       rewritten(description, content) as 4ae3a4151de9 using amend by test (*) (glob)
         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
         --- a/changeset-description
         +++ b/changeset-description
         @@ -1,1 +1,3 @@
         -A0
         +A1
         +
         +Better commit message
  
         diff -r 471f378eab4c -r 4ae3a4151de9 A0
         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
         @@ -1,1 +1,2 @@
          A0
         +42
  
  
  $ hg obslog --patch --color debug
  @  [evolve.node|4ae3a4151de9] [evolve.rev|(2)] [evolve.short_description|A1]
  |
  x  [evolve.node|471f378eab4c] [evolve.rev|(1)] [evolve.short_description|A0]
       [evolve.verb|rewritten](description, content) as [evolve.node|4ae3a4151de9] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)]
         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
         [diff.file_a|--- a/changeset-description]
         [diff.file_b|+++ b/changeset-description]
         [diff.hunk|@@ -1,1 +1,3 @@]
         [diff.deleted|-A0]
         [diff.inserted|+A1]
         [diff.inserted|+]
         [diff.inserted|+Better commit message]
  
         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 A0]
         [diff.file_a|--- a/A0	Thu Jan 01 00:00:00 1970 +0000]
         [diff.file_b|+++ b/A0	Thu Jan 01 00:00:00 1970 +0000]
         [diff.hunk|@@ -1,1 +1,2 @@]
          A0
         [diff.inserted|+42]
  
  

  $ hg obslog --no-graph --patch 4ae3a4151de9
  4ae3a4151de9 (2) A1
  471f378eab4c (1) A0
    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
      diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
      --- a/changeset-description
      +++ b/changeset-description
      @@ -1,1 +1,3 @@
      -A0
      +A1
      +
      +Better commit message
  
      diff -r 471f378eab4c -r 4ae3a4151de9 A0
      --- a/A0	Thu Jan 01 00:00:00 1970 +0000
      +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
      @@ -1,1 +1,2 @@
       A0
      +42
  

  $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", shortdescription)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}'
  @  A1
  |
  x  A0 at 0 0 by test
  
  $ hg obslog 4ae3a4151de9 --no-graph -Tjson | python -m json.tool
  [
      {
          "markers": [],
          "node": "4ae3a4151de9",
          "rev": 2,
          "shortdescription": "A1"
      },
      {
          "markers": [
              {
                  "date": [
                      *, (glob)
                      0 (glob)
                  ],
                  "effect": [
                      "description",
                      "content"
                  ],
                  "operation": "amend",
                  "succnodes": [
                      "4ae3a4151de9"
                  ],
                  "user": "test",
                  "verb": "rewritten"
              }
          ],
          "node": "471f378eab4c",
          "rev": 1,
          "shortdescription": "A0"
      }
  ]
  $ hg obslog --hidden --patch 471f378eab4c
  x  471f378eab4c (1) A0
       rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
         diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
         --- a/changeset-description
         +++ b/changeset-description
         @@ -1,1 +1,3 @@
         -A0
         +A1
         +
         +Better commit message
  
         diff -r 471f378eab4c -r 4ae3a4151de9 A0
         --- a/A0	Thu Jan 01 00:00:00 1970 +0000
         +++ b/A0	Thu Jan 01 00:00:00 1970 +0000
         @@ -1,1 +1,2 @@
          A0
         +42
  
  
  $ hg obslog --hidden 471f378eab4c --no-graph -Tjson | python -m json.tool
  [
      {
          "markers": [
              {
                  "date": [
                      *, (glob)
                      0 (glob)
                  ],
                  "effect": [
                      *, (glob)
                      "content"
                  ],
                  "operation": "amend",
                  "succnodes": [
                      "4ae3a4151de9"
                  ],
                  "user": "test",
                  "verb": "rewritten"
              }
          ],
          "node": "471f378eab4c",
          "rev": 1,
          "shortdescription": "A0"
      }
  ]
  $ hg update 471f378eab4c
  abort: hidden revision '471f378eab4c' was rewritten as: 4ae3a4151de9!
  (use --hidden to access hidden revisions)
  [255]
  $ hg update --hidden "desc(A0)"
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  updated to hidden changeset 471f378eab4c
  (hidden revision '471f378eab4c' was rewritten as: 4ae3a4151de9)
  working directory parent is obsolete! (471f378eab4c)
  (use 'hg evolve' to update to its successor: 4ae3a4151de9)