Added support for amending a non-head revision
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 12 Feb 2018 22:31:32 +0000
changeset 813 dab0996374c8
parent 810 c04f9722d89f
child 814 f082e56d6ff7
Added support for amending a non-head revision ...if evolve extension is on.
mercurial/HGCommitDialog.st
mercurial/HGCommitTask.st
mercurial/HGRevsetEditor.st
mercurial/HGStXTests.st
--- a/mercurial/HGCommitDialog.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGCommitDialog.st	Mon Feb 12 22:31:32 2018 +0000
@@ -23,7 +23,7 @@
 SCMAbstractCommitDialog subclass:#HGCommitDialog
 	instanceVariableNames:'remoteHolder remoteListHolder remotePushHolder branchCreateHolder
 		branchHolder moreOptionsHolder amendHolder amendLabel
-		bookmarkCreateHolder bookmarkHolder'
+		bookmarkCreateHolder bookmarkHolder commitingNewHeadAcknowledged'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SCM-Mercurial-StX-Interface'
@@ -679,11 +679,12 @@
 update:aspect with:param from:sender
     sender == amendHolder ifTrue:[
         self updateMessage.
+        self doCheckHead.
         ^ self.
     ].
     super update:aspect with:param from:sender
 
-    "Modified: / 25-08-2015 / 11:58:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-02-2018 / 19:00:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 updateAmendLabel
@@ -797,6 +798,15 @@
     "Created: / 09-02-2018 / 08:50:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGCommitDialog methodsFor:'initialization'!
+
+initialize
+    super initialize.
+    commitingNewHeadAcknowledged := false.
+
+    "Created: / 12-02-2018 / 19:09:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGCommitDialog methodsFor:'private'!
 
 doCheckAuthor
@@ -830,18 +840,22 @@
 doCheckHead
     "Checks whether commit would create a new head"
 
-    self task isCommitingNewHead ifTrue:[
+    commitingNewHeadAcknowledged ifTrue:[ ^ self ].
+
+    (self amendHolder value not and:[self task isCommitingNewHead]) ifTrue:[
         self infoPanel 
             reset;
             beInformation;
             message: (self resources string:'Comitting a new head.');
-            addButtonWithLabel: (self resources string:'Proceed') action: [self infoPanel hide];
+            addButtonWithLabel: (self resources string:'Proceed') action: [ commitingNewHeadAcknowledged := true. self infoPanel hide];
             "/addButtonWithLabel: (self resources string:'Cancel') action:[self doCancel];
             show.
-    ]
+    ] ifFalse:[ 
+        self infoPanel hide.
+    ].
 
     "Created: / 07-12-2012 / 15:52:18 / jv"
-    "Modified: / 08-03-2013 / 20:13:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-02-2018 / 19:10:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 doRunSanityChecks
--- a/mercurial/HGCommitTask.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGCommitTask.st	Mon Feb 12 22:31:32 2018 +0000
@@ -360,6 +360,11 @@
     temporaryWorkingCopy changesetId = HGChangesetId null ifTrue:[ 
         ^ false
     ].
+    "/ Any changeset can be amended if we have evolve 
+    "/ extension
+    temporaryWorkingCopy repository hasExtensionEvolve ifTrue:[ 
+        ^ true
+    ].
 
     "/ One cannot ammend changeset with children, so
     "/ check whether the logical revision is one od the
@@ -367,7 +372,7 @@
     ^ self isCommitingNewHead not
 
     "Created: / 27-08-2015 / 18:29:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 28-08-2015 / 12:16:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 12-02-2018 / 18:56:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 isCommitingNewHead
--- a/mercurial/HGRevsetEditor.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGRevsetEditor.st	Mon Feb 12 22:31:32 2018 +0000
@@ -18,6 +18,8 @@
 "
 "{ Package: 'stx:libscm/mercurial' }"
 
+"{ NameSpace: Smalltalk }"
+
 ApplicationModel subclass:#HGRevsetEditor
 	instanceVariableNames:'revsetHolder revsetList revsetField revsetFieldBackground
 		errorHolder'
@@ -242,3 +244,10 @@
     "Created: / 25-03-2014 / 02:03:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGRevsetEditor class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/mercurial/HGStXTests.st	Fri Feb 09 12:06:00 2018 +0000
+++ b/mercurial/HGStXTests.st	Mon Feb 12 22:31:32 2018 +0000
@@ -2218,7 +2218,8 @@
 test_commit_29
     "
     Simple commit amending. Check that commit cannot be amended
-    when not commiting on top of head revision...
+    when not commiting on top of head revision (but only if
+    evolve is not enabled, with evolve it's possible)
     "
 
     | repo pm ct |
@@ -2226,6 +2227,7 @@
     UserPreferences current hgUseSharedRepositories: true. 
 
     repo := self repositoryNamed: 'mocks/hg/p2' revision: '2'.
+    self skipIf: repo hasExtensionEvolve description: 'evolve extension is enabled'.
     self assert: (Smalltalk loadPackage:'mocks:hg/p2').
     self dumpRepositoryLog: repo.
 
@@ -2242,6 +2244,7 @@
     self dumpRepositoryLog: repo.
 
     "Created: / 27-08-2015 / 18:37:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 22-03-2018 / 23:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 test_commit_30a