tests/test-debugcommands.t
author Gregory Szorc <gregory.szorc@gmail.com>
Sat, 28 Mar 2015 12:58:44 -0700
changeset 24503 944749de6f3a
parent 23547 21446f4d5c62
child 26918 0438df737fb7
permissions -rw-r--r--
commands.debugrevlog: report max chain length This is sometimes useful to know. Report it.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17188
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     1
  $ hg init debugrevlog
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     2
  $ cd debugrevlog
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     3
  $ echo a > a
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     4
  $ hg ci -Am adda
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     5
  adding a
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     6
  $ hg debugrevlog -m
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     7
  format : 1
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     8
  flags  : inline
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
     9
  
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    10
  revisions     :  1
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    11
      merges    :  0 ( 0.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    12
      normal    :  1 (100.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    13
  revisions     :  1
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    14
      full      :  1 (100.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    15
      deltas    :  0 ( 0.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    16
  revision size : 44
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    17
      full      : 44 (100.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    18
      deltas    :  0 ( 0.00%)
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    19
  
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    20
  avg chain length  : 0
24503
944749de6f3a commands.debugrevlog: report max chain length
Gregory Szorc <gregory.szorc@gmail.com>
parents: 23547
diff changeset
    21
  max chain length  : 0
17188
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    22
  compression ratio : 0
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    23
  
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    24
  uncompressed data size (min/max/avg) : 43 / 43 / 43
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    25
  full revision size (min/max/avg)     : 44 / 44 / 44
76e55914c303 debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
diff changeset
    26
  delta size (min/max/avg)             : 0 / 0 / 0
20244
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    27
23547
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    28
Test debugindex, with and without the --debug flag
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    29
  $ hg debugindex a
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    30
     rev    offset  length   .... linkrev nodeid       p1           p2 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    31
       0         0       3   ....       0 b789fdd96dc2 000000000000 000000000000 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    32
  $ hg --debug debugindex a
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    33
     rev    offset  length   .... linkrev nodeid                                   p1                                       p2 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    34
       0         0       3   ....       0 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    35
  $ hg debugindex -f 1 a
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    36
     rev flag   offset   length     size   ....   link     p1     p2       nodeid (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    37
       0 0000        0        3        2   ....      0     -1     -1 b789fdd96dc2 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    38
  $ hg --debug debugindex -f 1 a
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    39
     rev flag   offset   length     size   ....   link     p1     p2                                   nodeid (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    40
       0 0000        0        3        2   ....      0     -1     -1 b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 (re)
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    41
21446f4d5c62 debugindex: respect --debug flag to show full nodeids
Kyle Lippincott <spectral@google.com>
parents: 23256
diff changeset
    42
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    43
Test max chain len
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    44
  $ cat >> $HGRCPATH << EOF
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    45
  > [format]
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    46
  > maxchainlen=4
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    47
  > EOF
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    48
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    49
  $ printf "This test checks if maxchainlen config value is respected also it can serve as basic test for debugrevlog -d <file>.\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    50
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    51
  $ printf "b\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    52
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    53
  $ printf "c\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    54
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    55
  $ printf "d\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    56
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    57
  $ printf "e\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    58
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    59
  $ printf "f\n" >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    60
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    61
  $ printf 'g\n' >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    62
  $ hg ci -m a
23256
1c11393d5dfb localrepo: rename revlog.maxchainlen to format.maxchainlen
Augie Fackler <raf@durin42.com>
parents: 23255
diff changeset
    63
  $ printf 'h\n' >> a
23255
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    64
  $ hg ci -m a
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    65
  $ hg debugrevlog -d a
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    66
  # rev p1rev p2rev start   end deltastart base   p1   p2 rawsize totalsize compression heads chainlen
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    67
      0    -1    -1     0   ???          0    0    0    0     ???      ????           ?     1        0 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    68
      1     0    -1   ???   ???          0    0    0    0     ???      ????           ?     1        1 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    69
      2     1    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        2 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    70
      3     2    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        3 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    71
      4     3    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        4 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    72
      5     4    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        0 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    73
      6     5    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        1 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    74
      7     6    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        2 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    75
      8     7    -1   ???   ???        ???  ???  ???    0     ???      ????           ?     1        3 (glob)
76effa770ff9 revlog: add config variable for limiting delta-chain length
Mateusz Kwapich <mitrandir@fb.com>
parents: 20543
diff changeset
    76
  $ cd ..
20244
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    77
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    78
Test internal debugstacktrace command
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    79
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    80
  $ cat > debugstacktrace.py << EOF
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    81
  > from mercurial.util import debugstacktrace, dst, sys
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    82
  > def f():
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    83
  >     dst('hello world')
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    84
  > def g():
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    85
  >     f()
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    86
  >     debugstacktrace(skip=-5, f=sys.stdout)
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    87
  > g()
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    88
  > EOF
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    89
  $ python debugstacktrace.py
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    90
  hello world at:
20543
01df3660eb11 tests: backout a82de9dc4f77, debugstacktrace is now stable, drop workaround
Mads Kiilerich <madski@unity3d.com>
parents: 20382
diff changeset
    91
   debugstacktrace.py:7 in * (glob)
20244
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    92
   debugstacktrace.py:5 in g
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    93
   debugstacktrace.py:3 in f
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    94
  stacktrace at:
20543
01df3660eb11 tests: backout a82de9dc4f77, debugstacktrace is now stable, drop workaround
Mads Kiilerich <madski@unity3d.com>
parents: 20382
diff changeset
    95
   debugstacktrace.py:7 *in * (glob)
01df3660eb11 tests: backout a82de9dc4f77, debugstacktrace is now stable, drop workaround
Mads Kiilerich <madski@unity3d.com>
parents: 20382
diff changeset
    96
   debugstacktrace.py:6 *in g (glob)
20244
47d0843647d1 util: introduce util.debugstacktrace for showing a stack trace without crashing
Mads Kiilerich <madski@unity3d.com>
parents: 17188
diff changeset
    97
   */util.py:* in debugstacktrace (glob)