D6696: abort: added support for transplant

2019-08-08 Thread taapas1128 (Taapas Agrawal)
taapas1128 marked an inline comment as done.
taapas1128 updated this revision to Diff 16160.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6696?vs=16070&id=16160

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

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

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
@@ -1,10 +1,17 @@
-#testcases commandmode continueflag
+#testcases commandmode abortflag continueflag
   $ cat <> $HGRCPATH
   > [extensions]
   > transplant=
   > graphlog=
   > EOF
 
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = transplant --abort
+  > EOF
+#endif
+
 #if continueflag
   $ cat >> $HGRCPATH < [alias]
@@ -460,7 +467,7 @@
   abort: fix up the working directory and run hg transplant --continue
   [255]
 
-  $ hg transplant --abort
+  $ hg abort
   transplant aborted
   working directory is now at e8643552fde5
 Repo log after abort
@@ -514,8 +521,9 @@
   abort: no transplant to continue (continueflag !)
   abort: no operation in progress (no-continueflag !)
   [255]
-  $ hg transplant --abort
-  abort: no transplant to abort
+  $ hg abort
+  abort: no transplant to abort (abortflag !)
+  abort: no operation in progress (no-abortflag !)
   [255]
   $ hg transplant 1
   applying 46ae92138f3c
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -762,6 +762,13 @@
 tp = transplanter(ui, repo, {})
 return tp.resume(repo, repo, {})
 
+def aborttransplant(ui, repo):
+"""logic to abort a transplnat in progress using
+'hg abort'"""
+with repo.wlock():
+tp = transplanter(ui, repo, {})
+return tp.abort(ui, repo)
+
 revsetpredicate = registrar.revsetpredicate()
 
 @revsetpredicate('transplanted([set])')
@@ -788,7 +795,7 @@
 def extsetup(ui):
 statemod.addunfinished (
 'transplant', fname='transplant/journal', clearable=True,
-continuefunc=continuetransplant,
+continuefunc=continuetransplant, abortfunc=aborttransplant,
 )
 
 # tell hggettext to extract docstrings from these functions:



To: taapas1128, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6696: abort: added support for transplant

2019-08-07 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> transplant.py:779
> +tp = transplanter(ui, repo, {})
> +tp.abort(ui, repo)
> +return

`return tp.abort(..)` instead.

REPOSITORY
  rHG Mercurial

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

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

To: taapas1128, #hg-reviewers
Cc: pulkit, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6696: abort: added support for transplant

2019-07-26 Thread taapas1128 (Taapas Agrawal)
taapas1128 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This adds support of `transplant--abort` to
  `hg abort`. A seperate `aborttransplant` function is
  created for that.
  
  Results are shown in tests.

REPOSITORY
  rHG Mercurial

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

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
@@ -1,10 +1,17 @@
-#testcases commandmode continueflag
+#testcases commandmode abortflag continueflag
   $ cat <> $HGRCPATH
   > [extensions]
   > transplant=
   > graphlog=
   > EOF
 
+#if abortflag
+  $ cat >> $HGRCPATH < [alias]
+  > abort = transplant --abort
+  > EOF
+#endif
+
 #if continueflag
   $ cat >> $HGRCPATH < [alias]
@@ -460,7 +467,7 @@
   abort: fix up the working directory and run hg transplant --continue
   [255]
 
-  $ hg transplant --abort
+  $ hg abort
   transplant aborted
   working directory is now at e8643552fde5
 Repo log after abort
@@ -514,8 +521,9 @@
   abort: no transplant to continue (continueflag !)
   abort: no operation in progress (no-continueflag !)
   [255]
-  $ hg transplant --abort
-  abort: no transplant to abort
+  $ hg abort
+  abort: no transplant to abort (abortflag !)
+  abort: no operation in progress (no-abortflag !)
   [255]
   $ hg transplant 1
   applying 46ae92138f3c
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -771,6 +771,14 @@
 tp.resume(repo, repo, opts)
 return
 
+def aborttransplant(ui, repo):
+"""logic to abort a transplnat in progress using
+'hg abort'"""
+with repo.wlock():
+tp = transplanter(ui, repo, {})
+tp.abort(ui, repo)
+return
+
 revsetpredicate = registrar.revsetpredicate()
 
 @revsetpredicate('transplanted([set])')
@@ -797,7 +805,7 @@
 def extsetup(ui):
 statemod.addunfinished (
 'transplant', fname='transplant/journal', clearable=True,
-continuefunc=continuetransplant,
+continuefunc=continuetransplant, abortfunc=aborttransplant,
 statushint=_('To continue:hg transplant --continue\n'
  'To abort:   hg transplant --abort'),
 cmdhint=_("use 'hg transplant --continue' or 'hg transplant --abort' "



To: taapas1128, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel