tests/test-rebase-legacy.t
author Jun Wu <quark@fb.com>
Tue, 05 Sep 2017 13:37:36 -0700
changeset 34087 5361771f9714
parent 34004 af609bb3487f
child 35393 4441705b7111
permissions -rw-r--r--
wrapfunction: use functools.partial if possible Every `extensions.bind` call inserts a frame in traceback: ... in closure return func(*(args + a), **kw) which makes traceback noisy. The Python stdlib has a `functools.partial` which is backed by C code and does not pollute traceback. However it does not support instancemethod and sets `args` attribute which could be problematic for alias handling. This patch makes `wrapfunction` use `functools.partial` if we are wrapping a function directly exported by a module (so it's impossible to be a class or instance method), and special handles `wrapfunction` results so alias handling code could handle `args` just fine. As an example, `hg rebase -s . -d . --traceback` got 6 lines removed in my setup: File "hg/mercurial/dispatch.py", line 898, in _dispatch cmdpats, cmdoptions) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/journal.py", line 84, in runcommand return orig(lui, repo, cmd, fullargs, *args) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "fb-hgext/hgext3rd/fbamend/hiddenoverride.py", line 119, in runcommand result = orig(lui, repo, cmd, fullargs, *args) File "hg/mercurial/dispatch.py", line 660, in runcommand ret = _runcommand(ui, options, cmd, d) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/pager.py", line 69, in pagecmd return orig(ui, options, cmd, cmdfunc) .... Differential Revision: https://phab.mercurial-scm.org/D632
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34004
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     1
Test rebase --continue with rebasestate written by legacy client
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     2
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     3
  $ cat >> $HGRCPATH <<EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     4
  > [extensions]
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     5
  > rebase=
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     6
  > drawdag=$TESTDIR/drawdag.py
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     7
  > EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     8
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
     9
  $ hg init
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    10
  $ hg debugdrawdag <<'EOF'
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    11
  >    D H
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    12
  >    | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    13
  >    C G
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    14
  >    | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    15
  >    B F
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    16
  >    | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    17
  >  Z A E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    18
  >   \|/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    19
  >    R
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    20
  > EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    21
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    22
rebasestate generated by a legacy client running "hg rebase -r B+D+E+G+H -d Z"
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    23
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    24
  $ touch .hg/last-message.txt
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    25
  $ cat > .hg/rebasestate <<EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    26
  > 0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    27
  > f424eb6a8c01c4a0c0fba9f863f79b3eb5b4b69f
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    28
  > 0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    29
  > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    30
  > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    31
  > 0
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    32
  > 
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    33
  > 21a6c45028857f500f56ae84fbf40689c429305b:-2
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    34
  > de008c61a447fcfd93f808ef527d933a84048ce7:0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    35
  > c1e6b162678d07d0b204e5c8267d51b4e03b633c:0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    36
  > aeba276fcb7df8e10153a07ee728d5540693f5aa:-3
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    37
  > bd5548558fcf354d37613005737a143871bf3723:-3
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    38
  > d2fa1c02b2401b0e32867f26cce50818a4bd796a:0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    39
  > 6f7a236de6852570cd54649ab62b1012bb78abc8:0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    40
  > 6582e6951a9c48c236f746f186378e36f59f4928:0000000000000000000000000000000000000000
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    41
  > EOF
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    42
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    43
  $ hg rebase --continue
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    44
  rebasing 4:c1e6b162678d "B" (B)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    45
  rebasing 8:6f7a236de685 "D" (D)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    46
  rebasing 2:de008c61a447 "E" (E)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    47
  rebasing 7:d2fa1c02b240 "G" (G)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    48
  rebasing 9:6582e6951a9c "H" (H tip)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    49
  warning: orphaned descendants detected, not stripping c1e6b162678d, de008c61a447
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    50
  saved backup bundle to $TESTTMP/.hg/strip-backup/6f7a236de685-9880a3dc-rebase.hg (glob)
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    51
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    52
  $ hg log -G -T '{rev}:{node|short} {desc}\n'
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    53
  o  11:721b8da0a708 H
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    54
  |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    55
  o  10:9d65695ec3c2 G
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    56
  |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    57
  o  9:21c8397a5d68 E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    58
  |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    59
  | o  8:fc52970345e8 D
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    60
  | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    61
  | o  7:eac96551b107 B
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    62
  |/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    63
  | o  6:bd5548558fcf C
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    64
  | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    65
  | | o  5:aeba276fcb7d F
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    66
  | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    67
  | o |  4:c1e6b162678d B
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    68
  | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    69
  o | |  3:f424eb6a8c01 Z
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    70
  | | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    71
  +---o  2:de008c61a447 E
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    72
  | |
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    73
  | o  1:21a6c4502885 A
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    74
  |/
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    75
  o  0:b41ce7760717 R
af609bb3487f rebase: change internal format to support destination map
Jun Wu <quark@fb.com>
parents:
diff changeset
    76