tests/test-rebase-dest.t
author Bryan O'Sullivan <bryano@fb.com>
Tue, 11 Apr 2017 14:54:12 -0700
changeset 31956 c13ff31818b0
parent 31733 ae6bab095c66
child 33332 3b7cb3d17137
permissions -rw-r--r--
ui: add special-purpose atexit functionality In spite of its longstanding use, Python's built-in atexit code is not suitable for Mercurial's purposes, for several reasons: * Handlers run after application code has finished. * Because of this, the code that runs handlers swallows exceptions (since there's no possible stacktrace to associate errors with). If we're lucky, we'll get something spat out to stderr (if stderr still works), which of course isn't any use in a big deployment where it's important that exceptions get logged and aggregated. * Mercurial's current atexit handlers make unfortunate assumptions about process state (specifically stdio) that, coupled with the above problems, make it impossible to deal with certain categories of error (try "hg status > /dev/full" on a Linux box). * In Python 3, the atexit implementation is completely hidden, so we can't hijack the platform's atexit code to run handlers at a time of our choosing. As a result, here's a perfectly cromulent atexit-like implementation over which we have control. This lets us decide exactly when the handlers run (after each request has completed), and control what the process state is when that occurs (and afterwards).
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31729
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     1
Require a destination
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     2
  $ cat >> $HGRCPATH <<EOF
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     3
  > [extensions]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     4
  > rebase =
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     5
  > [commands]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     6
  > rebase.requiredest = True
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     7
  > EOF
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     8
  $ hg init repo
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
     9
  $ cd repo
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    10
  $ echo a >> a
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    11
  $ hg commit -qAm aa
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    12
  $ echo b >> b
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    13
  $ hg commit -qAm bb
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    14
  $ hg up ".^"
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    15
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    16
  $ echo c >> c
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    17
  $ hg commit -qAm cc
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    18
  $ hg rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    19
  abort: you must specify a destination
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    20
  (use: hg rebase -d REV)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    21
  [255]
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    22
  $ hg rebase -d 1
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    23
  rebasing 2:5db65b93a12b "cc" (tip)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    24
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/5db65b93a12b-4fb789ec-backup.hg (glob)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    25
  $ hg rebase -d 0 -r . -q
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    26
  $ HGPLAIN=1 hg rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    27
  rebasing 2:889b0bc6a730 "cc" (tip)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    28
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/889b0bc6a730-41ec4f81-backup.hg (glob)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    29
  $ hg rebase -d 0 -r . -q
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    30
  $ hg --config commands.rebase.requiredest=False rebase
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    31
  rebasing 2:279de9495438 "cc" (tip)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    32
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/279de9495438-ab0a5128-backup.hg (glob)
c069c4e271e3 rebase: move destination test to new test file
Ryan McElroy <rmcelroy@fb.com>
parents:
diff changeset
    33
31730
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    34
Requiring dest should not break continue or other rebase options
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    35
  $ hg up 1 -q
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    36
  $ echo d >> c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    37
  $ hg commit -qAm dc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    38
  $ hg log -G -T '{rev} {desc}'
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    39
  @  3 dc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    40
  |
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    41
  | o  2 cc
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    42
  |/
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    43
  o  1 bb
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    44
  |
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    45
  o  0 aa
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    46
  
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    47
  $ hg rebase -d 2
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    48
  rebasing 3:0537f6b50def "dc" (tip)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    49
  merging c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    50
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    51
  unresolved conflicts (see hg resolve, then hg rebase --continue)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    52
  [1]
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    53
  $ echo d > c
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    54
  $ hg resolve --mark --all
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    55
  (no more unresolved files)
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    56
  continue: hg rebase --continue
6931c3346551 rebase: test to show brokenness with requiredest
Ryan McElroy <rmcelroy@fb.com>
parents: 31729
diff changeset
    57
  $ hg rebase --continue
31731
b5afec71c1f9 rebase: allow destination-free continue and abort (issue5513)
Ryan McElroy <rmcelroy@fb.com>
parents: 31730
diff changeset
    58
  rebasing 3:0537f6b50def "dc" (tip)
b5afec71c1f9 rebase: allow destination-free continue and abort (issue5513)
Ryan McElroy <rmcelroy@fb.com>
parents: 31730
diff changeset
    59
  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0537f6b50def-be4c7386-backup.hg (glob)
31732
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    60
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    61
  $ cd ..
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    62
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    63
Check rebase.requiredest interaction with pull --rebase
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    64
  $ hg clone repo clone
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    65
  updating to branch default
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    66
  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    67
  $ cd repo
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    68
  $ echo e > e
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    69
  $ hg commit -qAm ee
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    70
  $ cd ..
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    71
  $ cd clone
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    72
  $ echo f > f
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    73
  $ hg commit -qAm ff
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    74
  $ hg pull --rebase
31733
ae6bab095c66 rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)
Ryan McElroy <rmcelroy@fb.com>
parents: 31732
diff changeset
    75
  abort: rebase destination required by configuration
ae6bab095c66 rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514)
Ryan McElroy <rmcelroy@fb.com>
parents: 31732
diff changeset
    76
  (use hg pull followed by hg rebase -d DEST)
31732
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    77
  [255]
9ddf875183b0 rebase: demonstrate behavior with requiredest and pull --rebase
Ryan McElroy <rmcelroy@fb.com>
parents: 31731
diff changeset
    78