Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit e2684fa

Browse files
committed
Revert "Include tip in hg result set"
This reverts commit e7fc7d2. The hg model was actually right - it was the logic error in the caching layer that was messing things up.
1 parent fd8d0c4 commit e2684fa

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

gps/vcs_source.go

+7-9
Original file line numberDiff line numberDiff line change
@@ -409,22 +409,20 @@ func (s *hgSource) listVersions(ctx context.Context) ([]PairedVersion, error) {
409409
continue
410410
}
411411

412+
// tip is magic, don't include it
413+
if bytes.HasPrefix(line, []byte("tip")) {
414+
continue
415+
}
416+
412417
// Split on colon; this gets us the rev and the tag plus local revno
413418
pair := bytes.Split(line, []byte(":"))
414419
if bytes.Equal(nulrev, pair[1]) {
415420
// null rev indicates this tag is marked for deletion
416421
continue
417422
}
418423

419-
// tip moves like a branch, so treat it that way
420-
var v PairedVersion
421-
if bytes.HasPrefix(line, []byte("tip")) {
422-
v = NewBranch("tip").Is(Revision(pair[1])).(PairedVersion)
423-
} else {
424-
idx := bytes.IndexByte(pair[0], 32) // space
425-
v = NewVersion(string(pair[0][:idx])).Is(Revision(pair[1])).(PairedVersion)
426-
}
427-
424+
idx := bytes.IndexByte(pair[0], 32) // space
425+
v := NewVersion(string(pair[0][:idx])).Is(Revision(pair[1])).(PairedVersion)
428426
vlist = append(vlist, v)
429427
}
430428

gps/vcs_source_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,6 @@ func testHgSourceInteractions(t *testing.T) {
496496
NewBranch("another").Is(Revision("b10d05d581e5401f383e48ccfeb84b48fde99d06")),
497497
NewBranch("default").Is(Revision("3d466f437f6616da594bbab6446cc1cb4328d1bb")),
498498
NewBranch("newbranch").Is(Revision("5e2a01be9aee942098e44590ae545c7143da9675")),
499-
NewBranch("tip").Is(Revision("5e2a01be9aee942098e44590ae545c7143da9675")),
500499
})
501500
close(donech)
502501
}()
@@ -506,7 +505,6 @@ func testHgSourceInteractions(t *testing.T) {
506505
newDefaultBranch("default").Is(Revision("3d466f437f6616da594bbab6446cc1cb4328d1bb")),
507506
NewBranch("another").Is(Revision("b10d05d581e5401f383e48ccfeb84b48fde99d06")),
508507
NewBranch("newbranch").Is(Revision("5e2a01be9aee942098e44590ae545c7143da9675")),
509-
NewBranch("tip").Is(Revision("5e2a01be9aee942098e44590ae545c7143da9675")),
510508
})
511509

512510
<-donech

0 commit comments

Comments
 (0)