tests/test-oldconvert.t
author Martin von Zweigbergk <martinvonz@google.com>
Fri, 09 Sep 2016 16:42:41 -0700
changeset 1732 f4047fba5e90
parent 1065 f355bbc124fc
child 1810 ce4018f03520
permissions -rw-r--r--
templates: change {obsolete} to emit only "obsolete" or "" The {obsolete} template function can currently emit "stable", "unstable", "extinct", or "suspended". The distinction between "extinct" and "suspended" seems likely to be more confusing that enlightening, and "stable" and "unstable" are not even obsolete. Let's simplify it to just emit "obsolete" for obsolete changesets and "" for others. That will also make it much easier to test for obsolete changsets and do things like "if(obsolete, obsolete, troubles)".
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
224
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     1
  $ cat >> $HGRCPATH <<EOF
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     2
  > [web]
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     3
  > push_ssl = false
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     4
  > allow_push = *
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     5
  > [phases]
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     6
  > publish=False
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     7
  > [alias]
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     8
  > odiff=diff --rev 'limit(obsparents(.),1)' --rev .
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
     9
  > [extensions]
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    10
  > hgext.graphlog=
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    11
  > EOF
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    12
  $ mkcommit() {
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    13
  >    echo "$1" > "$1"
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    14
  >    hg add "$1"
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    15
  >    hg ci -m "add $1"
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    16
  > }
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    17
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    18
create commit
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    19
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    20
  $ hg init repo
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    21
  $ cd repo
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    22
  $ mkcommit a
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    23
  $ mkcommit b
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    24
  $ hg up -q 0
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    25
  $ mkcommit c
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    26
  created new head
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    27
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    28
forge old style relation files
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    29
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    30
  $ hg log -r 2 --template='{node} ' > .hg/obsolete-relations
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    31
  $ hg log -r 1 --template='{node}' >> .hg/obsolete-relations
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    32
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    33
enable the extensions
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    34
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    35
  $ echo "obsolete=$(echo $(dirname $TESTDIR))/hgext/obsolete.py" >> $HGRCPATH
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    36
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    37
  $ hg glog
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    38
  abort: old format of obsolete marker detected!
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    39
  run `hg debugconvertobsolete` once.
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    40
  [255]
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    41
  $ hg debugconvertobsolete --traceback
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    42
  1 obsolete marker converted
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    43
  $ hg glog
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    44
  @  changeset:   2:d67cd0334eee
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    45
  |  tag:         tip
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    46
  |  parent:      0:1f0dee641bb7
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    47
  |  user:        test
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    48
  |  date:        Thu Jan 01 00:00:00 1970 +0000
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    49
  |  summary:     add c
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    50
  |
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    51
  o  changeset:   0:1f0dee641bb7
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    52
     user:        test
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    53
     date:        Thu Jan 01 00:00:00 1970 +0000
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    54
     summary:     add a
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    55
  
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 350
diff changeset
    56
  $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 441
diff changeset
    57
  7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 (*) {'user': 'test'} (glob)
224
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    58
  $ hg debugconvertobsolete
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    59
  nothing to do
f60555898df4 new obsolete store
Pierre-Yves.David@ens-lyon.org
parents:
diff changeset
    60
  0 obsolete marker converted
334
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    61
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    62
Convert json
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    63
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    64
  $ cat > .hg/store/obsoletemarkers << EOF
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    65
  > [
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    66
  >     {
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    67
  >         "reason": "import from older format.", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    68
  >         "subjects": [
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    69
  >             "3218406b50ed13480765e7c260669620f37fba6e"
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    70
  >         ], 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    71
  >         "user": "Pierre-Yves David <pierre-yves.david@ens-lyon.org>", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    72
  >         "date": [
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    73
  >             1336503323.9768269, 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    74
  >             -7200
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    75
  >         ], 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    76
  >         "object": "3e03d82708d4da97a92158558dd13386d8f09ad5", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    77
  >         "id": "4743f676eaf3923cb98c921ee06b2e91052c365b"
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    78
  >     }, 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    79
  >     {
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    80
  >         "reason": "import from older format.", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    81
  >         "user": "Pierre-Yves David <pierre-yves.david@logilab.fr>", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    82
  >         "date": [
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    83
  >             1336557472.7875929, 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    84
  >             -7200
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    85
  >         ], 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    86
  >         "object": "5c722672795c3a2cb94d0cc9a821c394c1475f87", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    87
  >         "id": "1fd90a84b7225d2e3062b7e1b3100aa2e060fc72"
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    88
  >     }, 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    89
  >     {
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    90
  >         "reason": "import from older format.", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    91
  >         "subjects": [
350
b836862d48b4 [convert] properly exclude null successors from convertion
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 334
diff changeset
    92
  >             "0000000000000000000000000000000000000000"
334
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    93
  >         ], 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    94
  >         "user": "Pierre-Yves David <pierre-yves.david@logilab.fr>", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    95
  >         "date": [
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    96
  >             1336557472.784307, 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    97
  >             -7200
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    98
  >         ], 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
    99
  >         "object": "2c3784e102bb34ccc93862af5bd6d609ee30c577", 
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   100
  >         "id": "7d940c5ee1f886c8a6c0d805b43e522cb3ef7a15"
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   101
  >     }
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   102
  > ]
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   103
  > EOF
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   104
  $ hg glog
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   105
  abort: old format of obsolete marker detected!
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   106
  run `hg debugconvertobsolete` once.
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   107
  [255]
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   108
  $ hg debugconvertobsolete --traceback
fb83210bce32 obsolete: move to official binary format
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 224
diff changeset
   109
  3 obsolete marker converted
441
d702f0d26c6a obsolete: remove debugsuccessors
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 350
diff changeset
   110
  $ hg debugobsolete
1065
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 441
diff changeset
   111
  7c3bad9141dcb46ff89abf5f61856facd56e476c d67cd0334eeecfded222fed9009f0db4beb57585 0 (*) {'user': 'test'} (glob)
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 441
diff changeset
   112
  3e03d82708d4da97a92158558dd13386d8f09ad5 3218406b50ed13480765e7c260669620f37fba6e 0 (Tue May 08 20:55:23 2012 +0200) {'user': 'Pierre-Yves David <pierre-yves.david@ens-lyon.org>'}
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 441
diff changeset
   113
  5c722672795c3a2cb94d0cc9a821c394c1475f87 0 (Wed May 09 11:57:52 2012 +0200) {'user': 'Pierre-Yves David <pierre-yves.david@logilab.fr>'}
f355bbc124fc test: update test to new date formatting in debuobsolete output
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 441
diff changeset
   114
  2c3784e102bb34ccc93862af5bd6d609ee30c577 0 (Wed May 09 11:57:52 2012 +0200) {'user': 'Pierre-Yves David <pierre-yves.david@logilab.fr>'}