D6695: transplant: added support for --stop flag

2019-08-16 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG4d10aada6c3b: transplant: added support for --stop flag 
(authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6695?vs=16215=16223

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6695/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6695

AFFECTED FILES
  hgext/transplant.py
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -2,6 +2,7 @@
   $ cat <> $HGRCPATH
   > [extensions]
   > transplant=
+  > graphlog=
   > EOF
 
 #if continueflag
@@ -19,6 +20,9 @@
   $ hg transplant --continue --all
   abort: --continue is incompatible with --branch, --all and --merge
   [255]
+  $ hg transplant --stop --all
+  abort: --stop is incompatible with --branch, --all and --merge
+  [255]
   $ hg transplant --all tip
   abort: --all requires a branch revision
   [255]
@@ -376,7 +380,8 @@
   applying 722f4667af76
   722f4667af76 transplanted to 76e321915884
 
-transplant --continue
+
+transplant --continue and --stop behaviour
 
   $ hg init ../tc
   $ cd ../tc
@@ -416,6 +421,36 @@
   $ echo foobar > foo
   $ hg ci -mfoobar
   created new head
+
+Repo log before transplant
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
   $ hg transplant 1:3
   applying 46ae92138f3c
   patching file foo
@@ -425,6 +460,49 @@
   abort: fix up the working directory and run hg transplant --continue
   [255]
 
+  $ hg transplant --stop
+  stopped the interrupted transplant
+  working directory is now at e8643552fde5
+Repo log after abort
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
+  $ hg transplant 1:3
+  applying 46ae92138f3c
+  file added already exists
+  1 out of 1 hunks FAILED -- saving rejects to file added.rej
+  patching file foo
+  Hunk #1 FAILED at 0
+  1 out of 1 hunks FAILED -- saving rejects to file foo.rej
+  patch failed to apply
+  abort: fix up the working directory and run hg transplant --continue
+  [255]
+
 transplant -c shouldn't use an old changeset
 
   $ hg up -C
@@ -436,6 +514,9 @@
   abort: no transplant to continue (continueflag !)
   abort: no operation in progress (no-continueflag !)
   [255]
+  $ hg transplant --stop
+  abort: no interrupted transplant found
+  [255]
   $ hg transplant 1
   applying 46ae92138f3c
   patching file foo
@@ -489,23 +570,23 @@
   [255]
   $ hg transplant 1:3
   abort: transplant in progress
-  (use 'hg transplant --continue' or 'hg update' to abort)
+  (use 'hg transplant --continue' or 'hg transplant --stop')
   [255]
   $ hg status -v
   A bar
+  ? added.rej
   ? baz.rej
   ? foo.rej
   # The repository is in an unfinished *transplant* state.
   
   # To continue:hg transplant --continue
-  # To abort:   hg update
+  # To stop:hg transplant --stop
   
   $ echo fixed > baz
   $ hg continue
   9d6d6b5a8275 transplanted as d80c49962290
   applying 1dab759070cf
   1dab759070cf transplanted to aa0ffe6bd5ae
-
   $ cd ..
 
 Issue: Test transplant --merge
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -412,6 +412,17 @@
 # this is kept only to reduce changes in a patch.
 pass
 
+def stop(self, ui, repo):
+"""logic to stop an interrupted transplant"""
+if self.canresume():
+startctx = repo['.']
+

D6695: transplant: added support for --stop flag

2019-08-15 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 16215.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6695?vs=16214=16215

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6695/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6695

AFFECTED FILES
  hgext/transplant.py
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -2,6 +2,7 @@
   $ cat <> $HGRCPATH
   > [extensions]
   > transplant=
+  > graphlog=
   > EOF
 
 #if continueflag
@@ -19,6 +20,9 @@
   $ hg transplant --continue --all
   abort: --continue is incompatible with --branch, --all and --merge
   [255]
+  $ hg transplant --stop --all
+  abort: --stop is incompatible with --branch, --all and --merge
+  [255]
   $ hg transplant --all tip
   abort: --all requires a branch revision
   [255]
@@ -376,7 +380,8 @@
   applying 722f4667af76
   722f4667af76 transplanted to 76e321915884
 
-transplant --continue
+
+transplant --continue and --stop behaviour
 
   $ hg init ../tc
   $ cd ../tc
@@ -416,6 +421,36 @@
   $ echo foobar > foo
   $ hg ci -mfoobar
   created new head
+
+Repo log before transplant
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
   $ hg transplant 1:3
   applying 46ae92138f3c
   patching file foo
@@ -425,6 +460,49 @@
   abort: fix up the working directory and run hg transplant --continue
   [255]
 
+  $ hg transplant --stop
+  stopped the interrupted transplant
+  working directory is now at e8643552fde5
+Repo log after abort
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
+  $ hg transplant 1:3
+  applying 46ae92138f3c
+  file added already exists
+  1 out of 1 hunks FAILED -- saving rejects to file added.rej
+  patching file foo
+  Hunk #1 FAILED at 0
+  1 out of 1 hunks FAILED -- saving rejects to file foo.rej
+  patch failed to apply
+  abort: fix up the working directory and run hg transplant --continue
+  [255]
+
 transplant -c shouldn't use an old changeset
 
   $ hg up -C
@@ -436,6 +514,9 @@
   abort: no transplant to continue (continueflag !)
   abort: no operation in progress (no-continueflag !)
   [255]
+  $ hg transplant --stop
+  abort: no interrupted transplant found
+  [255]
   $ hg transplant 1
   applying 46ae92138f3c
   patching file foo
@@ -489,23 +570,23 @@
   [255]
   $ hg transplant 1:3
   abort: transplant in progress
-  (use 'hg transplant --continue' or 'hg update' to abort)
+  (use 'hg transplant --continue' or 'hg transplant --stop')
   [255]
   $ hg status -v
   A bar
+  ? added.rej
   ? baz.rej
   ? foo.rej
   # The repository is in an unfinished *transplant* state.
   
   # To continue:hg transplant --continue
-  # To abort:   hg update
+  # To stop:hg transplant --stop
   
   $ echo fixed > baz
   $ hg continue
   9d6d6b5a8275 transplanted as d80c49962290
   applying 1dab759070cf
   1dab759070cf transplanted to aa0ffe6bd5ae
-
   $ cd ..
 
 Issue: Test transplant --merge
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -412,6 +412,17 @@
 # this is kept only to reduce changes in a patch.
 pass
 
+def stop(self, ui, repo):
+"""logic to stop an interrupted transplant"""
+if self.canresume():
+startctx = repo['.']
+hg.updaterepo(repo, startctx.node(), overwrite=True)
+ui.status(_("stopped the interrupted transplant\n"))
+

D6695: transplant: added support for --stop flag

2019-08-15 Thread taapas1128 (Taapas Agrawal)
taapas1128 edited the summary of this revision.
taapas1128 retitled this revision from "transplant: added support for --abort 
flag" to "transplant: added support for --stop flag".
taapas1128 marked an inline comment as done.
taapas1128 updated this revision to Diff 16214.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6695?vs=16162=16214

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6695/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6695

AFFECTED FILES
  hgext/transplant.py
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -2,6 +2,7 @@
   $ cat <> $HGRCPATH
   > [extensions]
   > transplant=
+  > graphlog=
   > EOF
 
 #if continueflag
@@ -19,6 +20,9 @@
   $ hg transplant --continue --all
   abort: --continue is incompatible with --branch, --all and --merge
   [255]
+  $ hg transplant --stop --all
+  abort: --stop is incompatible with --branch, --all and --merge
+  [255]
   $ hg transplant --all tip
   abort: --all requires a branch revision
   [255]
@@ -376,7 +380,8 @@
   applying 722f4667af76
   722f4667af76 transplanted to 76e321915884
 
-transplant --continue
+
+transplant --continue and --abort behaviour
 
   $ hg init ../tc
   $ cd ../tc
@@ -416,6 +421,36 @@
   $ echo foobar > foo
   $ hg ci -mfoobar
   created new head
+
+Repo log before transplant
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
   $ hg transplant 1:3
   applying 46ae92138f3c
   patching file foo
@@ -425,6 +460,49 @@
   abort: fix up the working directory and run hg transplant --continue
   [255]
 
+  $ hg transplant --stop
+  stopped the interrupted transplant
+  working directory is now at e8643552fde5
+Repo log after abort
+  $ hg glog
+  @  changeset:   4:e8643552fde5
+  |  tag: tip
+  |  parent:  0:493149fa1541
+  |  user:test
+  |  date:Thu Jan 01 00:00:00 1970 +
+  |  summary: foobar
+  |
+  | o  changeset:   3:1dab759070cf
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar2
+  | |
+  | o  changeset:   2:9d6d6b5a8275
+  | |  user:test
+  | |  date:Thu Jan 01 00:00:00 1970 +
+  | |  summary: bar
+  | |
+  | o  changeset:   1:46ae92138f3c
+  |/   user:test
+  |date:Thu Jan 01 00:00:00 1970 +
+  |summary: foo2
+  |
+  o  changeset:   0:493149fa1541
+ user:test
+ date:Thu Jan 01 00:00:00 1970 +
+ summary: foo
+  
+  $ hg transplant 1:3
+  applying 46ae92138f3c
+  file added already exists
+  1 out of 1 hunks FAILED -- saving rejects to file added.rej
+  patching file foo
+  Hunk #1 FAILED at 0
+  1 out of 1 hunks FAILED -- saving rejects to file foo.rej
+  patch failed to apply
+  abort: fix up the working directory and run hg transplant --continue
+  [255]
+
 transplant -c shouldn't use an old changeset
 
   $ hg up -C
@@ -436,6 +514,9 @@
   abort: no transplant to continue (continueflag !)
   abort: no operation in progress (no-continueflag !)
   [255]
+  $ hg transplant --stop
+  abort: no interrupted transplant found
+  [255]
   $ hg transplant 1
   applying 46ae92138f3c
   patching file foo
@@ -489,23 +570,23 @@
   [255]
   $ hg transplant 1:3
   abort: transplant in progress
-  (use 'hg transplant --continue' or 'hg update' to abort)
+  (use 'hg transplant --continue' or 'hg transplant --stop')
   [255]
   $ hg status -v
   A bar
+  ? added.rej
   ? baz.rej
   ? foo.rej
   # The repository is in an unfinished *transplant* state.
   
   # To continue:hg transplant --continue
-  # To abort:   hg update
+  # To stop:hg transplant --stop
   
   $ echo fixed > baz
   $ hg continue
   9d6d6b5a8275 transplanted as d80c49962290
   applying 1dab759070cf
   1dab759070cf transplanted to aa0ffe6bd5ae
-
   $ cd ..
 
 Issue: Test transplant --merge
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -412,6 +412,17 @@
 # this is kept only to reduce changes in a patch.
 pass
 
+def stop(self, ui, repo):
+"""logic to stop an interrupted