# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1546940111 0
# Tue Jan 08 09:35:11 2019 +0000
# Node ID 6839f138ff173a601b4d7c79d9e88ca2ce9f4f0b
# Parent f376c52fbc5b617c035db4e84854b1895fdb0183
Issue 256: fix parsing branch name from changelog
To retrieve a branch of an changeset, `stx:libscm` uses `{branch}`
branch keyword and then parses it as "name list". However, according
to documentation it is a single string:
branch String. The name of the branch on which the changeset was
committed.
This obviously caused problems when branch name had spaces in it.
This commit fixes the problem.
One remaining thing is that `stx:libscm` technically allows a changeset
to be in more than one branch which seems to be impossible in
Mercurial itself. This should be investigated and fixed, eventually.
diff -r f376c52fbc5b -r 6839f138ff17 mercurial/HGCommandParser.st
a
|
b
|
|
392 | 392 | |
393 | 393 | rev := HGChangeset new. |
394 | 394 | rev setId: self parseNodeId. self expectLineEnd. |
395 | | branches := self parseNameList. self expectLineEnd. |
| 395 | branches := Array with: stream nextLine. |
396 | 396 | rev setBranches: branches. |
397 | 397 | rev setParent1Id: self parseNodeId. self expectSpace. |
398 | 398 | rev setParent2Id: self parseNodeId. self expectSpace. self expectLineEnd. |
… |
… |
|
430 | 430 | ^rev |
431 | 431 | |
432 | 432 | "Created: / 13-11-2012 / 09:45:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
433 | | "Modified: / 19-03-2014 / 23:23:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 433 | "Modified: / 07-01-2019 / 22:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
434 | 434 | ! |
435 | 435 | |
436 | 436 | parseMergeLocalChanged: info |
diff -r f376c52fbc5b -r 6839f138ff17 mercurial/HGTests.st
a
|
b
|
|
453 | 453 | self assert: branches anElement name = 'default' |
454 | 454 | |
455 | 455 | "Created: / 14-01-2013 / 14:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 456 | ! |
| 457 | |
| 458 | test_branches_issue256a |
| 459 | " |
| 460 | Change branch with spaces & commit. Check whether commited changeset |
| 461 | has the branch set. |
| 462 | " |
| 463 | |
| 464 | | repo wc | |
| 465 | |
| 466 | repo := self repositoryNamed:'test_repo_01'. |
| 467 | wc := repo workingCopy. |
| 468 | self assert: repo branches size == 1. |
| 469 | wc branch: 'test branches issue256a'. |
| 470 | |
| 471 | "Modify some file" |
| 472 | (wc / 'f1.txt') writingFileDo:[:s | s nextPutAll:'modified...' ]. |
| 473 | wc commit: testSelector , ' - commit 01'. |
| 474 | |
| 475 | self assert: wc changeset branches size == 1. |
| 476 | self assert: wc changeset branches anElement name = 'test branches issue256a'. |
| 477 | self assert: repo branches size == 2. |
| 478 | self assert:(repo branches contains: [:b|b name = 'default']). |
| 479 | self assert:(repo branches contains: [:b|b name = 'test branches issue256a']). |
| 480 | |
| 481 | "Created: / 07-01-2019 / 22:42:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
456 | 482 | ! ! |
457 | 483 | |
458 | 484 | !HGTests methodsFor:'tests - changesets'! |