mercurial/HGRevset.st
changeset 405 9906c030ae1d
parent 372 5acd6d915c77
child 509 f92210d4585b
--- a/mercurial/HGRevset.st	Fri Mar 21 22:05:03 2014 +0000
+++ b/mercurial/HGRevset.st	Tue Mar 25 09:43:46 2014 +0000
@@ -19,7 +19,7 @@
 "{ Package: 'stx:libscm/mercurial' }"
 
 Object subclass:#HGRevset
-	instanceVariableNames:'expression'
+	instanceVariableNames:'expression comment'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SCM-Mercurial-Core'
@@ -71,12 +71,44 @@
 
 !HGRevset class methodsFor:'instance creation'!
 
+expression: expression comment: comment
+    ^ self new setExpression: expression comment: comment.
+
+    "Created: / 24-03-2014 / 21:55:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 fromString: aString
     ^ self new setExpression: aString
 
     "Created: / 07-02-2014 / 12:59:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGRevset methodsFor:'comparing'!
+
+= another
+    ^ (another isKindOf: self class)
+        and:[ self asString = another asString ].
+
+    "Created: / 24-03-2014 / 21:52:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+hash
+    ^ expression hash
+
+    "Created: / 24-03-2014 / 21:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!HGRevset methodsFor:'constructing'!
+
+reverse
+    expression isNil ifTrue:[ ^ self ].
+    ^ self class    
+        expression: 'reverse(', (expression ? '') , ')'
+        comment:  comment
+
+    "Created: / 25-03-2014 / 01:42:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGRevset methodsFor:'conversion'!
 
 asHGRevset
@@ -91,11 +123,35 @@
     "Created: / 07-02-2014 / 12:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!HGRevset methodsFor:'displaying'!
+
+displayString
+    ^ comment notNil 
+        ifTrue:[ expression asText , ((' - ', comment) asText colorizeAllWith: Color gray)]
+        ifFalse:[ expression ]
+
+    "Created: / 24-03-2014 / 21:44:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-03-2014 / 01:27:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !HGRevset methodsFor:'initialization'!
 
+setComment: aString
+    comment := aString
+
+    "Created: / 24-03-2014 / 21:43:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 setExpression: aString
     expression := aString
 
     "Created: / 07-02-2014 / 12:59:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setExpression: expr comment: comm
+    expression := expr.
+    comment := comm
+
+    "Created: / 24-03-2014 / 21:55:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !