tests/test-grab.t
branchmercurial-4.3
changeset 4077 9c025ec4af88
parent 4076 f9a850018daa
child 4275 b4ffdeb2afd8
equal deleted inserted replaced
4033:b609412b42b0 4077:9c025ec4af88
    14   > }
    14   > }
    15 
    15 
    16   $ hg init repo
    16   $ hg init repo
    17   $ cd repo
    17   $ cd repo
    18   $ hg help grab
    18   $ hg help grab
    19   hg grab [-r] rev
    19   hg pick [-r] rev
       
    20   
       
    21   aliases: grab
    20   
    22   
    21   grabs a commit, move it on the top of working directory parent and
    23   grabs a commit, move it on the top of working directory parent and
    22       updates to it.
    24       updates to it.
    23   
    25   
    24   options:
    26   options:
    25   
    27   
    26    -r --rev VALUE revision to grab
    28    -r --rev VALUE revision to pick
    27    -c --continue  continue interrupted grab
    29    -c --continue  continue interrupted pick
    28    -a --abort     abort interrupted grab
    30    -a --abort     abort interrupted pick
    29   
    31   
    30   (some details hidden, use --verbose to show complete help)
    32   (some details hidden, use --verbose to show complete help)
    31 
    33 
    32   $ mkcommit a
    34   $ mkcommit a
    33   $ mkcommit b
    35   $ mkcommit b
    41   o  0:1f0dee641bb7 add a
    43   o  0:1f0dee641bb7 add a
    42   
    44   
    43 
    45 
    44 Grabbing an ancestor
    46 Grabbing an ancestor
    45 
    47 
    46   $ hg grab -r 7c3bad9141dc
    48   $ hg pick -r 7c3bad9141dc
    47   abort: cannot grab an ancestor revision
    49   abort: cannot pick an ancestor revision
    48   [255]
    50   [255]
    49 
    51 
    50 Grabbing the working directory parent
    52 Grabbing the working directory parent
    51 
    53 
    52   $ hg grab -r .
    54   $ hg pick -r .
    53   abort: cannot grab an ancestor revision
    55   abort: cannot pick an ancestor revision
    54   [255]
    56   [255]
    55 
    57 
    56 Specifying multiple revisions to grab
    58 Specifying multiple revisions to grab
    57 
    59 
    58   $ hg grab 1f0dee641bb7 -r 7c3bad9141dc
    60   $ hg pick 1f0dee641bb7 -r 7c3bad9141dc
    59   abort: specify just one revision
    61   abort: specify just one revision
    60   [255]
    62   [255]
    61 
    63 
    62 Specifying no revisions to grab
    64 Specifying no revisions to grab
    63 
    65 
    64   $ hg grab
    66   $ hg pick
    65   abort: empty revision set
    67   abort: empty revision set
    66   [255]
    68   [255]
    67 
    69 
    68 Continuing without interrupted grab
    70 Continuing without interrupted grab
    69 
    71 
    70   $ hg grab --continue
    72   $ hg pick --continue
    71   abort: no interrupted grab state exists
    73   abort: no interrupted pick state exists
    72   [255]
    74   [255]
    73 
    75 
    74 Aborting without interrupted grab
    76 Aborting without interrupted grab
    75 
    77 
    76   $ hg grab --abort
    78   $ hg pick --abort
    77   abort: no interrupted grab state exists
    79   abort: no interrupted pick state exists
    78   [255]
    80   [255]
    79 
    81 
    80 Specifying both continue and revs
    82 Specifying both continue and revs
    81 
    83 
    82   $ hg up 1f0dee641bb7
    84   $ hg up 1f0dee641bb7
    83   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
    85   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
    84   $ hg grab -r 4538525df7e2 --continue
    86   $ hg pick -r 4538525df7e2 --continue
    85   abort: cannot specify both --continue and revision
    87   abort: cannot specify both --continue and revision
    86   [255]
    88   [255]
    87 
    89 
    88 Making new branch heads
    90 Making new branch heads
    89 
    91 
   102   |/
   104   |/
   103   o  0:1f0dee641bb7 add a
   105   o  0:1f0dee641bb7 add a
   104   
   106   
   105 Grabbing a revision
   107 Grabbing a revision
   106 
   108 
   107   $ hg grab 7c3bad9141dc
   109   $ hg pick 7c3bad9141dc
   108   grabbing 1:7c3bad9141dc "add b"
   110   picking 1:7c3bad9141dc "add b"
   109   $ hg glog
   111   $ hg glog
   110   @  5:7c15c05db6fa add b
   112   @  5:7c15c05db6fa add b
   111   |
   113   |
   112   o  4:d46dc301d92f add y
   114   o  4:d46dc301d92f add y
   113   |
   115   |
   138   | |
   140   | |
   139   | x  1:7c3bad9141dc add b
   141   | x  1:7c3bad9141dc add b
   140   |/
   142   |/
   141   o  0:1f0dee641bb7 add a
   143   o  0:1f0dee641bb7 add a
   142   
   144   
   143   $ hg grab -r 4538525df7e2
   145   $ hg pick -r 4538525df7e2
   144   grabbing 2:4538525df7e2 "add c"
   146   picking 2:4538525df7e2 "add c"
   145   note: grab of 2:4538525df7e2 created no changes to commit
   147   note: picking 2:4538525df7e2 created no changes to commit
   146 
   148 
   147   $ hg glog
   149   $ hg glog
   148   @  6:c4636a81ebeb add c
   150   @  6:c4636a81ebeb add c
   149   |
   151   |
   150   o  5:7c15c05db6fa add b
   152   o  5:7c15c05db6fa add b
   159 
   161 
   160   $ hg up d46dc301d92f
   162   $ hg up d46dc301d92f
   161   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   163   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   162   $ echo foo > c
   164   $ echo foo > c
   163   $ hg ci -Aqm "foo to c"
   165   $ hg ci -Aqm "foo to c"
   164   $ hg grab -r c4636a81ebeb
   166   $ hg pick -r c4636a81ebeb
   165   grabbing 6:c4636a81ebeb "add c"
   167   picking 6:c4636a81ebeb "add c"
   166   merging c
   168   merging c
   167   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   169   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   168   unresolved merge conflicts (see hg help resolve)
   170   unresolved merge conflicts (see hg help resolve)
   169   [1]
   171   [1]
   170 
   172 
   171   $ echo foobar > c
   173   $ echo foobar > c
   172   $ hg resolve --all --mark
   174   $ hg resolve --all --mark
   173   (no more unresolved files)
   175   (no more unresolved files)
   174   continue: hg grab --continue
   176   continue: hg pick --continue
   175   $ hg grab --continue
   177   $ hg pick --continue
   176   $ hg glog
   178   $ hg glog
   177   @  8:44e155eb95c7 add c
   179   @  8:44e155eb95c7 add c
   178   |
   180   |
   179   o  7:2ccc03d1d096 foo to c
   181   o  7:2ccc03d1d096 foo to c
   180   |
   182   |
   197   created new head
   199   created new head
   198 
   200 
   199   $ hg up 44e155eb95c7
   201   $ hg up 44e155eb95c7
   200   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   202   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   201 
   203 
   202   $ hg grab 4e04628911f6
   204   $ hg pick 4e04628911f6
   203   grabbing 9:4e04628911f6 "foo to c"
   205   picking 9:4e04628911f6 "foo to c"
   204   merging c
   206   merging c
   205   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   207   warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
   206   unresolved merge conflicts (see hg help resolve)
   208   unresolved merge conflicts (see hg help resolve)
   207   [1]
   209   [1]
   208   $ echo foobar > c
   210   $ echo foobar > c
   209   $ hg resolve -m
   211   $ hg resolve -m
   210   (no more unresolved files)
   212   (no more unresolved files)
   211   continue: hg grab --continue
   213   continue: hg pick --continue
   212 
   214 
   213   $ hg grab --continue
   215   $ hg pick --continue
   214   note: grab of 9:4e04628911f6 created no changes to commit
   216   note: picking 9:4e04628911f6 created no changes to commit
   215 
   217 
   216 Testing the abort functionality of hg grab
   218 Testing the abort functionality of hg pick
   217 
   219 
   218   $ echo foo > b
   220   $ echo foo > b
   219   $ hg ci -Aqm "foo to b"
   221   $ hg ci -Aqm "foo to b"
   220   $ hg glog -r .^::
   222   $ hg glog -r .^::
   221   hg: parse error at 4: not a prefix: end
   223   hg: parse error at 4: not a prefix: end
   222   [255]
   224   [255]
   223 
   225 
   224   $ hg grab -r 7c15c05db6fa
   226   $ hg pick -r 7c15c05db6fa
   225   grabbing 5:7c15c05db6fa "add b"
   227   picking 5:7c15c05db6fa "add b"
   226   merging b
   228   merging b
   227   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   229   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   228   unresolved merge conflicts (see hg help resolve)
   230   unresolved merge conflicts (see hg help resolve)
   229   [1]
   231   [1]
   230 
   232 
   231   $ hg grab --abort
   233   $ hg pick --abort
   232   aborting grab, updating to c437988de89f
   234   aborting pick, updating to c437988de89f
   233 
   235 
   234   $ hg glog
   236   $ hg glog
   235   @  10:c437988de89f foo to b
   237   @  10:c437988de89f foo to b
   236   |
   238   |
   237   o  8:44e155eb95c7 add c
   239   o  8:44e155eb95c7 add c
   249 
   251 
   250 Trying to grab a public changeset
   252 Trying to grab a public changeset
   251 
   253 
   252   $ hg phase -r 7c15c05db6fa -p
   254   $ hg phase -r 7c15c05db6fa -p
   253 
   255 
   254   $ hg grab -r 7c15c05db6fa
   256   $ hg pick -r 7c15c05db6fa
   255   abort: cannot grab public changesets: 7c15c05db6fa
   257   abort: cannot pick public changesets: 7c15c05db6fa
   256   (see 'hg help phases' for details)
   258   (see 'hg help phases' for details)
   257   [255]
   259   [255]
   258 
   260 
   259   $ hg glog
   261   $ hg glog
   260   @  10:c437988de89f foo to b
   262   @  10:c437988de89f foo to b
   275 
   277 
   276 In case of merge conflicts
   278 In case of merge conflicts
   277 
   279 
   278   $ hg phase -r 7c15c05db6fa -s -f
   280   $ hg phase -r 7c15c05db6fa -s -f
   279 
   281 
   280   $ hg grab -r 7c15c05db6fa
   282   $ hg pick -r 7c15c05db6fa
   281   grabbing 5:7c15c05db6fa "add b"
   283   picking 5:7c15c05db6fa "add b"
   282   merging b
   284   merging b
   283   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   285   warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
   284   unresolved merge conflicts (see hg help resolve)
   286   unresolved merge conflicts (see hg help resolve)
   285   [1]
   287   [1]
   286 
   288 
   287   $ echo bar > b
   289   $ echo bar > b
   288   $ hg resolve -m
   290   $ hg resolve -m
   289   (no more unresolved files)
   291   (no more unresolved files)
   290   continue: hg grab --continue
   292   continue: hg pick --continue
   291 
   293 
   292   $ hg grab --continue
   294   $ hg pick --continue
   293   $ hg phase -r .
   295   $ hg phase -r .
   294   11: secret
   296   11: secret
   295 
   297 
   296 No merge conflicts
   298 No merge conflicts
   297 
   299 
   322   o  0:1f0dee641bb7 add a
   324   o  0:1f0dee641bb7 add a
   323   
   325   
   324   $ hg up 10427de9e26e
   326   $ hg up 10427de9e26e
   325   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
   327   3 files updated, 0 files merged, 1 files removed, 0 files unresolved
   326 
   328 
   327   $ hg grab -r 508d572e7053
   329   $ hg pick -r 508d572e7053
   328   grabbing 12:508d572e7053 "added l"
   330   picking 12:508d572e7053 "added l"
   329 
   331 
   330   $ hg phase -r .
   332   $ hg phase -r .
   331   13: secret
   333   13: secret