tests/test-rebase-dest.t
author Ryan McElroy <rmcelroy@fb.com>
Thu, 30 Mar 2017 03:50:10 -0700
changeset 31733 ae6bab095c66
parent 31732 9ddf875183b0
child 33332 3b7cb3d17137
permissions -rw-r--r--
rebase: abort hg pull --rebase if rebase.requiredest is set (issue5514) Previously, the pull would succeed, but the subsequent rebase would fail due to the rebase.requiredest flag. Now abort earlier with a more useful error message.
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