tests/test-grab.t
author Pulkit Goyal <7895pulkit@gmail.com>
Thu, 11 Jan 2018 20:03:20 +0530
changeset 3453 32ed5b6fadd3
child 3473 b2f591aa4507
permissions -rw-r--r--
grab: add a command to grab a commit and update to it This patch adds anew command `hg grab` which will pick a commit and put it on the top of the working directory parent and updates to it. Earlier grab was an alias for `hg rebase -r <rev> -d .` which is now deleted to make sure `hg grab` resolves to the grab command and that alias. Continuing interrupted grab functionality is also there using the evolvestate class. Tests are also added for the new introduced command.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3453
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     1
Test for the grab command
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     2
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     3
  $ cat >> $HGRCPATH <<EOF
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     4
  > [alias]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     5
  > glog = log -G -T "{rev}:{node|short} {desc}\n"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     6
  > [extensions]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     7
  > EOF
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     8
  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
     9
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    10
  $ mkcommit() {
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    11
  >    echo "$1" > "$1"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    12
  >    hg add "$1"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    13
  >    hg ci -m "add $1"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    14
  > }
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    15
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    16
  $ hg init repo
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    17
  $ cd repo
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    18
  $ hg help grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    19
  hg grab [-r] rev
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    20
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    21
  grabs a commit, move it on the top of working directory parent and
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    22
      updates to it.
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    23
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    24
  options:
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    25
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    26
   -r --rev VALUE revision to grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    27
      --continue  continue interrupted grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    28
      --abort     abort interrupted grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    29
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    30
  (some details hidden, use --verbose to show complete help)
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    31
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    32
  $ mkcommit a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    33
  $ mkcommit b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    34
  $ mkcommit c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    35
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    36
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    37
  @  2:4538525df7e2 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    38
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    39
  o  1:7c3bad9141dc add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    40
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    41
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    42
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    43
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    44
Grabbing an ancestor
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    45
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    46
  $ hg grab -r 7c3bad9141dc
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    47
  abort: cannot grab an ancestor revision
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    48
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    49
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    50
Specifying multiple revisions to grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    51
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    52
  $ hg grab 1f0dee641bb7 -r 7c3bad9141dc
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    53
  abort: specify just one revision
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    54
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    55
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    56
Specifying no revisions to grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    57
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    58
  $ hg grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    59
  abort: empty revision set
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    60
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    61
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    62
Continuing without interrupted grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    63
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    64
  $ hg grab --continue
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    65
  abort: no interrupted grab state exists
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    66
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    67
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    68
Aborting without interrupted grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    69
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    70
  $ hg grab --abort
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    71
  abort: no interrupted grab state exists
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    72
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    73
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    74
Specifying both continue and revs
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    75
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    76
  $ hg up 1f0dee641bb7
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    77
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    78
  $ hg grab -r 4538525df7e2 --continue
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    79
  abort: cannot specify both --continue and revision
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    80
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    81
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    82
Making new branch heads
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    83
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    84
  $ mkcommit x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    85
  created new head
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    86
  $ mkcommit y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    87
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    88
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    89
  @  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    90
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    91
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    92
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    93
  | o  2:4538525df7e2 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    94
  | |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    95
  | o  1:7c3bad9141dc add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    96
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    97
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    98
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
    99
Grabbing a revision
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   100
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   101
  $ hg grab 7c3bad9141dc
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   102
  grabbing 1:7c3bad9141dc "add b"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   103
  1 new orphan changesets
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   104
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   105
  @  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   106
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   107
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   108
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   109
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   110
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   111
  | *  2:4538525df7e2 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   112
  | |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   113
  | x  1:7c3bad9141dc add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   114
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   115
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   116
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   117
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   118
When grab does not create any changes
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   119
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   120
  $ hg graft -r 4538525df7e2
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   121
  grafting 2:4538525df7e2 "add c"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   122
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   123
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   124
  @  6:c4636a81ebeb add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   125
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   126
  o  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   127
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   128
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   129
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   130
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   131
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   132
  | *  2:4538525df7e2 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   133
  | |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   134
  | x  1:7c3bad9141dc add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   135
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   136
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   137
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   138
  $ hg grab -r 4538525df7e2
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   139
  grabbing 2:4538525df7e2 "add c"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   140
  note: grab of 2:4538525df7e2 created no changes to commit
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   141
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   142
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   143
  @  6:c4636a81ebeb add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   144
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   145
  o  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   146
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   147
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   148
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   149
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   150
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   151
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   152
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   153
interrupted grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   154
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   155
  $ hg up d46dc301d92f
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   156
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   157
  $ echo foo > c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   158
  $ hg ci -Aqm "foo to c"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   159
  $ hg grab -r c4636a81ebeb
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   160
  grabbing 6:c4636a81ebeb "add c"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   161
  merging c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   162
  warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   163
  unresolved merge conflicts (see hg help resolve)
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   164
  [1]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   165
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   166
  $ echo foobar > c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   167
  $ hg resolve --all --mark
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   168
  (no more unresolved files)
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   169
  $ hg grab --continue
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   170
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   171
  @  8:44e155eb95c7 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   172
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   173
  o  7:2ccc03d1d096 foo to c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   174
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   175
  | o  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   176
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   177
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   178
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   179
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   180
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   181
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   182
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   183
Testing the abort functionality of hg grab
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   184
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   185
  $ echo foo > b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   186
  $ hg ci -Aqm "foo to b"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   187
  $ hg glog -r .^::
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   188
  @  9:902d4f4602bb foo to b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   189
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   190
  o  8:44e155eb95c7 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   191
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   192
  ~
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   193
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   194
  $ hg grab -r 7c15c05db6fa
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   195
  grabbing 5:7c15c05db6fa "add b"
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   196
  merging b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   197
  warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   198
  unresolved merge conflicts (see hg help resolve)
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   199
  [1]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   200
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   201
  $ hg grab --abort
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   202
  aborting grab, updating to 902d4f4602bb
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   203
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   204
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   205
  @  9:902d4f4602bb foo to b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   206
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   207
  o  8:44e155eb95c7 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   208
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   209
  o  7:2ccc03d1d096 foo to c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   210
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   211
  | o  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   212
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   213
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   214
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   215
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   216
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   217
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   218
  
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   219
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   220
Trying to grab a public changeset
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   221
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   222
  $ hg phase -r 7c15c05db6fa -p
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   223
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   224
  $ hg grab -r 7c15c05db6fa
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   225
  abort: cannot grab public changesets: 7c15c05db6fa
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   226
  (see 'hg help phases' for details)
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   227
  [255]
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   228
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   229
  $ hg glog
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   230
  @  9:902d4f4602bb foo to b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   231
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   232
  o  8:44e155eb95c7 add c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   233
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   234
  o  7:2ccc03d1d096 foo to c
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   235
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   236
  | o  5:7c15c05db6fa add b
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   237
  |/
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   238
  o  4:d46dc301d92f add y
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   239
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   240
  o  3:8e224524cd09 add x
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   241
  |
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   242
  o  0:1f0dee641bb7 add a
32ed5b6fadd3 grab: add a command to grab a commit and update to it
Pulkit Goyal <7895pulkit@gmail.com>
parents:
diff changeset
   243