More robust error parsing
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 06 Nov 2014 01:06:39 +0000
changeset 466 ad91a31328a0
parent 465 adb48cfb1df7
child 467 0c2c8eb5df33
More robust error parsing Allow for *** failed to import extension... messages. This should fix tests for Mercurial 2.1
mercurial/HGCommandParser.st
mercurial/HGCommandParserTests.st
mercurial/Make.proto
mercurial/bc.mak
mercurial/mercurial.rc
--- a/mercurial/HGCommandParser.st	Tue Nov 04 16:07:41 2014 +0000
+++ b/mercurial/HGCommandParser.st	Thu Nov 06 01:06:39 2014 +0000
@@ -1099,32 +1099,61 @@
     "Created: / 04-02-2013 / 12:21:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-parseError: parseBlock
-    [ stream atEnd ] whileFalse:[
-        | word |
+parseError1: parseBlock
+    "/ Parse at most one error from stream and returs.
+
+    | c word line |
+
+    c := stream peek.
+    c isNil ifTrue:[ ^ self ]. "/ stream closed / already at end
 
+    "/ Care for "*** failed to import extension" messages...
+    c == $* ifTrue:[ 
+        stream next.
+        c := stream peek.
+        c == $* ifTrue:[ 
+            stream next.
+            c := stream peek.
+            c == $* ifTrue:[ 
+                stream next.
+                self notify: stream nextLine.
+                ^ self.
+            ].
+        ].
+        self error: 'Unexpected error output: ', stream nextLine.
+        ^ self.
+    ].
+    c == $a ifTrue:[
         word := stream upTo: $:.
         stream next. "/eat space
+        word = 'abort' ifTrue:[
+            parseBlock value: stream nextLine.
+            ^ self.
+        ].
+    ].
+    "/ Special hack for mercurial_keyring extension, sigh...
+    line := stream nextLine.
 
-        word = 'abort' ifTrue:[
-            ^parseBlock value: stream nextLine        
-        ] ifFalse:[
-            "Special hack for mercurial_keyring extension, sigh..."
-            (word endsWith: 'mercurial_keyring.py') ifTrue:[
-                (stream nextLine endsWith: 'UserWarning: Basic Auth Realm was unquoted') ifTrue:[
-                    stream nextLine.
-                ] ifFalse:[
-                    self breakPoint: #jv.
-                ]
-            ] ifFalse:[
-                self breakPoint: #jv.
-            ].
-        ]
+    (line includesSubString: 'mercurial_keyring.py') ifTrue:[
+        (line endsWith: 'UserWarning: Basic Auth Realm was unquoted') ifTrue:[
+            stream nextLine.
+        ].
+        ^ self.
+    ].
+    self error: 'Unexpected error output: ', line.
+    ^ self.
+
+    "Created: / 06-11-2014 / 00:28:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+parseError: parseBlock
+    [ stream atEnd ] whileFalse:[
+        self parseError1: parseBlock.  
     ].
     ^nil
 
     "Created: / 04-02-2013 / 12:21:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-07-2013 / 01:14:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-11-2014 / 00:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseErrorBookmark
@@ -1137,13 +1166,13 @@
     [ stream atEnd ] whileFalse:[
         | c word |
 
-        c := stream next.
+        c := stream peek.
         c == $i ifTrue:[
             "/ Mercurial <  2.7 uses 'invalidating branch cache (tip differs)'.
             "/ Mercurial >= 2.7 uses 'invalid branchheads cache (served): tip differs'
             "/                    or 'invalid branchheads cache (visible): tip differs'
             "/ Sigh...
-            self expect: 'nvalid'.
+            self expect: 'invalid'.
             c := stream peek.
             c == $a ifTrue:[
                 self expect: 'ating branch cache'.
@@ -1155,22 +1184,13 @@
 
 
         ] ifFalse:[
-            c == $a ifTrue:[
-                word := stream upTo: $:.
-                stream next. "/eat space
-
-                word = 'bort' ifTrue:[
-                    self propagate: HGCommandError message: stream nextLine
-                ] ifFalse:[
-                    self breakPoint: #jv.
-                ]
-            ]
+            self parseError1: [ :msg | self error: msg ]  
         ]
     ].
     ^nil
 
     "Created: / 06-02-2013 / 19:18:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 27-04-2014 / 11:06:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-11-2014 / 00:43:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseErrorClass: errorClass
--- a/mercurial/HGCommandParserTests.st	Tue Nov 04 16:07:41 2014 +0000
+++ b/mercurial/HGCommandParserTests.st	Thu Nov 06 01:06:39 2014 +0000
@@ -677,6 +677,15 @@
 ') parseError ] raise: Error.
 
     "Created: / 02-07-2013 / 01:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_error_02
+
+    self should:[
+        (HGCommandParser on: '*** failed to import extension histedit: No module named histedit
+abort: repository /some/funny/directory not found!!') parseError ] raise: HGError.
+
+    "Created: / 06-11-2014 / 00:12:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !HGCommandParserTests methodsFor:'tests - misc'!
--- a/mercurial/Make.proto	Tue Nov 04 16:07:41 2014 +0000
+++ b/mercurial/Make.proto	Thu Nov 06 01:06:39 2014 +0000
@@ -172,7 +172,7 @@
 $(OUTDIR)HGChangesetDialog.$(O) HGChangesetDialog.$(H): HGChangesetDialog.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libview2/SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetFile.$(O) HGChangesetFile.$(H): HGChangesetFile.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetId.$(O) HGChangesetId.$(H): HGChangesetId.st $(INCLUDE_TOP)/stx/libbasic/ArrayedCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/ByteArray.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/SequenceableCollection.$(H) $(INCLUDE_TOP)/stx/libbasic/UninterpretedBytes.$(H) $(STCHDR)
-$(OUTDIR)HGChangesetLabelsView.$(O) HGChangesetLabelsView.$(H): HGChangesetLabelsView.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(STCHDR)
+$(OUTDIR)HGChangesetLabelsView.$(O) HGChangesetLabelsView.$(H): HGChangesetLabelsView.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetList.$(O) HGChangesetList.$(H): HGChangesetList.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetPresenter.$(O) HGChangesetPresenter.$(H): HGChangesetPresenter.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetViewer.$(O) HGChangesetViewer.$(H): HGChangesetViewer.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(STCHDR)
--- a/mercurial/bc.mak	Tue Nov 04 16:07:41 2014 +0000
+++ b/mercurial/bc.mak	Thu Nov 06 01:06:39 2014 +0000
@@ -103,7 +103,7 @@
 $(OUTDIR)HGChangesetDialog.$(O) HGChangesetDialog.$(H): HGChangesetDialog.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libview2\SimpleDialog.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetFile.$(O) HGChangesetFile.$(H): HGChangesetFile.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetId.$(O) HGChangesetId.$(H): HGChangesetId.st $(INCLUDE_TOP)\stx\libbasic\ArrayedCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\ByteArray.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\SequenceableCollection.$(H) $(INCLUDE_TOP)\stx\libbasic\UninterpretedBytes.$(H) $(STCHDR)
-$(OUTDIR)HGChangesetLabelsView.$(O) HGChangesetLabelsView.$(H): HGChangesetLabelsView.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(STCHDR)
+$(OUTDIR)HGChangesetLabelsView.$(O) HGChangesetLabelsView.$(H): HGChangesetLabelsView.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetList.$(O) HGChangesetList.$(H): HGChangesetList.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetPresenter.$(O) HGChangesetPresenter.$(H): HGChangesetPresenter.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)HGChangesetViewer.$(O) HGChangesetViewer.$(H): HGChangesetViewer.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(STCHDR)
--- a/mercurial/mercurial.rc	Tue Nov 04 16:07:41 2014 +0000
+++ b/mercurial/mercurial.rc	Thu Nov 06 01:06:39 2014 +0000
@@ -3,7 +3,7 @@
 // automagically generated from the projectDefinition: stx_libscm_mercurial.
 //
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION     6,2,0,1
+  FILEVERSION     6,2,4817,4817
   PRODUCTVERSION  6,2,4,0
 #if (__BORLANDC__)
   FILEFLAGSMASK   VS_FF_DEBUG | VS_FF_PRERELEASE
@@ -20,12 +20,12 @@
     BEGIN
       VALUE "CompanyName", "Jan Vrany\0"
       VALUE "FileDescription", "Mercurial integration for Smalltalk/X (LIB)\0"
-      VALUE "FileVersion", "6.2.0.1\0"
+      VALUE "FileVersion", "6.2.4817.4817\0"
       VALUE "InternalName", "stx:libscm/mercurial\0"
       VALUE "LegalCopyright", "Copyright Jan Vrany 2012\0"
       VALUE "ProductName", "Smalltalk/X Mercurial Integration\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Wed, 30 Jul 2014 16:06:05 GMT\0"
+      VALUE "ProductDate", "Thu, 06 Nov 2014 01:04:56 GMT\0"
     END
 
   END