tests/test-pull-branch.t
author Matt Mackall <mpm@selenic.com>
Wed, 24 Nov 2010 15:56:32 -0600
changeset 13047 6c375e07d673
parent 12279 28e2e3804f2e
child 13803 e380964d53f8
permissions -rw-r--r--
branch: operate on branch names in local string space where possible Previously, branch names were ideally manipulated as UTF-8 strings, because they were stored as UTF-8 in the dirstate and the changelog and could not be safely converted to the local encoding and back. However, only about 80% of branch name code was actually using the right encoding conventions. This patch uses the localstr addition to allow working on branch names as local strings, which simplifies handling so that the previously incorrect code becomes correct.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     1
  $ hg init t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     2
  $ cd t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     3
  $ echo 1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     4
  $ hg ci -Am1 # 0
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     5
  adding foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     6
  $ hg branch branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     7
  marked working directory as branch branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     8
  $ echo a1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
     9
  $ hg ci -ma1 # 1
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    10
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    11
  $ cd ..
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    12
  $ hg init tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    13
  $ cd tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    14
  $ hg pull ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    15
  pulling from ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    16
  requesting all changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    17
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    18
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    19
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    20
  added 2 changesets with 2 changes to 1 files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    21
  (run 'hg update' to get a working copy)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    22
  $ hg up branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    23
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    24
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    25
  $ cd ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    26
  $ echo a2 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    27
  $ hg ci -ma2 # 2
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    28
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    29
Create branch B:
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    30
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    31
  $ hg up 0
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    32
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    33
  $ hg branch branchB
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    34
  marked working directory as branch branchB
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    35
  $ echo b1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    36
  $ hg ci -mb1 # 3
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    37
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    38
  $ cd ../tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    39
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    40
A new branch is there
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    41
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    42
  $ hg pull -u ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    43
  pulling from ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    44
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    45
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    46
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    47
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    48
  added 2 changesets with 2 changes to 1 files (+1 heads)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    49
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    50
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    51
Develop both branches:
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    52
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    53
  $ cd ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    54
  $ hg up branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    55
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    56
  $ echo a3 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    57
  $ hg ci -ma3 # 4
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    58
  $ hg up branchB
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    59
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    60
  $ echo b2 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    61
  $ hg ci -mb2 # 5
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    62
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    63
  $ cd ../tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    64
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    65
Should succeed, no new heads:
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    66
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    67
  $ hg pull -u ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    68
  pulling from ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    69
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    70
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    71
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    72
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    73
  added 2 changesets with 2 changes to 1 files
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    74
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    75
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    76
Add a head on other branch:
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    77
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    78
  $ cd ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    79
  $ hg up branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    80
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    81
  $ echo a4 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    82
  $ hg ci -ma4 # 6
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    83
  $ hg up branchB
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    84
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    85
  $ echo b3.1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    86
  $ hg ci -m b3.1 # 7
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    87
  $ hg up 5
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    88
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    89
  $ echo b3.2 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    90
  $ hg ci -m b3.2 # 8
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    91
  created new head
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    92
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    93
  $ cd ../tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    94
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    95
Should succeed because there is only one head on our branch:
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
    96
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    97
  $ hg pull -u ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    98
  pulling from ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
    99
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   100
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   101
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   102
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   103
  added 3 changesets with 3 changes to 1 files (+1 heads)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   104
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
   105
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   106
  $ cd ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   107
  $ hg up -C branchA
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   108
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   109
  $ echo a5.1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   110
  $ hg ci -ma5.1 # 9
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   111
  $ hg up 6
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   112
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   113
  $ echo a5.2 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   114
  $ hg ci -ma5.2 # 10
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   115
  created new head
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   116
  $ hg up 7
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   117
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   118
  $ echo b4.1 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   119
  $ hg ci -m b4.1 # 11
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   120
  $ hg up -C 8
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   121
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   122
  $ echo b4.2 > foo
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   123
  $ hg ci -m b4.2 # 12
7372
e17dbf140035 pull: update to branch tip if there is only one head on the current branch
Benoit Allard <benoit@aeteurope.nl>
parents:
diff changeset
   124
12279
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   125
  $ cd ../tt
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   126
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   127
  $ hg pull -u ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   128
  pulling from ../t
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   129
  searching for changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   130
  adding changesets
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   131
  adding manifests
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   132
  adding file changes
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   133
  added 4 changesets with 4 changes to 1 files (+1 heads)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   134
  not updating, since new heads added
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   135
  (run 'hg heads' to see heads, 'hg merge' to merge)
28e2e3804f2e combine tests
Adrian Buehlmann <adrian@cadifra.com>
parents: 7372
diff changeset
   136