Fixes parsing of `hg pull` for Mercurial 7.2.x
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 14 Nov 2013 13:33:16 +0000
changeset 358 a29af7da2825
parent 357 4f4a12ecfc4f
child 359 b6516e783b2d
Fixes parsing of `hg pull` for Mercurial 7.2.x
mercurial/HGCommandParser.st
mercurial/HGCommandParserTests.st
--- a/mercurial/HGCommandParser.st	Thu Oct 17 01:38:17 2013 +0100
+++ b/mercurial/HGCommandParser.st	Thu Nov 14 13:33:16 2013 +0000
@@ -796,13 +796,18 @@
 
 parseCommandPull
     "Parse output of 'hg pull' command. "
+
     "
-     Ex:
+    Ex:
 
-     pushing to /tmp/stx_tmp/stxtmp_7733_20/upstream
-     searching for changes
-     abort: push creates new remote head 0c8c5633f1ed!!
-     (you should pull and merge or use push -f to force)
+    pulling from ssh://dialin.exept.de/repositories/hg/exept.workflow
+    searching for changes
+    adding changesets
+    adding manifests
+    adding file changes
+    added 16 changesets with 16 changes to 14 files (+1 heads)
+    (run ''hg heads'' to see heads)       
+
     "
     | c |
     
@@ -823,10 +828,41 @@
         self notify: 'no changes found'.
         ^HGPushPullInfo new
     ].
+
+    [ c == $a ] whileTrue:[
+        self expect: 'add'.
+        c := stream peek.
+        c == $i ifTrue:[
+            "/ adding ...
+            self expect: 'ing '.
+            c := stream peek.
+            c == $c ifTrue:[
+                self expect: 'changesets'. stream nextLine.
+                self notify: 'adding changesets'.
+            ] ifFalse:[
+            c == $m ifTrue:[
+                self expect: 'manifests'. stream nextLine.
+                self notify: 'adding manifests'.
+            ] ifFalse:[
+            c == $f ifTrue:[
+                self expect: 'file changes'. stream nextLine.
+                self notify: 'adding file changes'.  
+            ]]]
+        ] ifFalse:[
+        c == $e ifTrue:[
+            "/ added ... ('add' already eaten...)
+            | line |
+
+            line := 'add' , stream nextLine.
+            ^ self parsePushPullSummaryInto: HGPushPullInfo new from: line readStream.
+        ]].
+        c := stream peek.
+    ].
+
     self error:('Unexpected character ''%1'' expecting ''r'' or ''n''' bindWith: c)
 
     "Created: / 04-02-2013 / 15:35:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 14-02-2013 / 15:25:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-11-2013 / 13:25:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseCommandPush
--- a/mercurial/HGCommandParserTests.st	Thu Oct 17 01:38:17 2013 +0100
+++ b/mercurial/HGCommandParserTests.st	Thu Nov 14 13:33:16 2013 +0000
@@ -297,6 +297,27 @@
     "Created: / 13-07-2013 / 11:47:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+test_cmd_pull_06a
+
+    | info |
+
+    info := (HGCommandParser on: 'pulling from ssh://dialin.exept.de/repositories/hg/exept.workflow
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 16 changesets with 16 changes to 14 files (+1 heads)
+(run ''hg heads'' to see heads)  
+') parseCommandPull.
+
+    self assert: info numChangesets = 16.
+    self assert: info numChanges = 16.
+    self assert: info numFiles = 14.
+    self assert: info numHeads = 1.
+
+    "Created: / 14-11-2013 / 13:14:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 test_cmd_push_01
 
     | info |