New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/build: rewrite Hg hashes in issue tracker #21088

Open
hanwen opened this Issue Jul 19, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@hanwen
Contributor

hanwen commented Jul 19, 2017

Some old issues refer to mercurial hashes in their issue tracker. There is a mapping at https://golang.org/change/XXXXX and the git commits have this data too (as a golang-hg header in the commit), but if you don't know that it can be hard to track down.

Instead of people having to know this, one could rewrite all codesite URLs in the issue tracker to become googlesource.com URLs.

example: #2516 mentions http://code.google.com/p/go/source/detail?r=4e38cad33649.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Jul 19, 2017

Out of curiosity, I searched for the "code.google.com/p/go/source/detail?r=" substring and found 237 matches, using:

func TestHGLinks(t *testing.T) {
        c := getGoData(t)
        repo := c.GitHub().Repo("golang", "go")
        repo.ForeachIssue(func(gi *maintner.GitHubIssue) error {
                return gi.ForeachComment(func(c *maintner.GitHubComment) error {
                        if !strings.Contains(c.Body, "code.google.com/p/go/source/detail?r=") {
                                return nil
                        }
                        fmt.Printf("https://github.com/golang/go/issues/%d#issuecomment-%d\n", gi.Number, c.ID)
                        return nil
                })
        })
}

(added to x/build/maintner/godata/godata_test.go)

Results:

#9 (comment)
#20 (comment)
#47 (comment)
#97 (comment)
#188 (comment)
#244 (comment)
#255 (comment)
#256 (comment)
#313 (comment)
#317 (comment)
#345 (comment)
#363 (comment)
#494 (comment)
#785 (comment)
#917 (comment)
#955 (comment)
#996 (comment)
#1033 (comment)
#1101 (comment)
#1143 (comment)
#1286 (comment)
#1297 (comment)
#1317 (comment)
#1325 (comment)
#1382 (comment)
#1439 (comment)
#1450 (comment)
#1450 (comment)
#1451 (comment)
#1464 (comment)
#1465 (comment)
#1508 (comment)
#1547 (comment)
#1552 (comment)
#1650 (comment)
#1704 (comment)
#1728 (comment)
#1734 (comment)
#1744 (comment)
#1750 (comment)
#1768 (comment)
#1816 (comment)
#1826 (comment)
#1894 (comment)
#1899 (comment)
#1916 (comment)
#1945 (comment)
#1960 (comment)
#1960 (comment)
#1972 (comment)
#1972 (comment)
#1973 (comment)
#1976 (comment)
#2019 (comment)
#2021 (comment)
#2041 (comment)
#2093 (comment)
#2093 (comment)
#2093 (comment)
#2152 (comment)
#2165 (comment)
#2206 (comment)
#2237 (comment)
#2281 (comment)
#2313 (comment)
#2328 (comment)
#2344 (comment)
#2396 (comment)
#2415 (comment)
#2444 (comment)
#2450 (comment)
#2451 (comment)
#2460 (comment)
#2516 (comment)
#2580 (comment)
#2590 (comment)
#2653 (comment)
#2653 (comment)
#2715 (comment)
#2726 (comment)
#2741 (comment)
#2787 (comment)
#2833 (comment)
#2841 (comment)
#2874 (comment)
#2919 (comment)
#2946 (comment)
#2947 (comment)
#2967 (comment)
#3050 (comment)
#3135 (comment)
#3170 (comment)
#3225 (comment)
#3254 (comment)
#3258 (comment)
#3293 (comment)
#3316 (comment)
#3329 (comment)
#3345 (comment)
#3352 (comment)
#3386 (comment)
#3431 (comment)
#3504 (comment)
#3523 (comment)
#3643 (comment)
#3660 (comment)
#3683 (comment)
#3683 (comment)
#3684 (comment)
#3702 (comment)
#3749 (comment)
#3787 (comment)
#3863 (comment)
#3863 (comment)
#3874 (comment)
#3875 (comment)
#3903 (comment)
#3917 (comment)
#4021 (comment)
#4054 (comment)
#4195 (comment)
#4259 (comment)
#4276 (comment)
#4276 (comment)
#4299 (comment)
#4459 (comment)
#4461 (comment)
#4477 (comment)
#4551 (comment)
#4551 (comment)
#4553 (comment)
#4643 (comment)
#4692 (comment)
#4721 (comment)
#4723 (comment)
#4834 (comment)
#4842 (comment)
#4868 (comment)
#4889 (comment)
#4892 (comment)
#4902 (comment)
#4973 (comment)
#4979 (comment)
#5028 (comment)
#5064 (comment)
#5091 (comment)
#5139 (comment)
#5148 (comment)
#5148 (comment)
#5148 (comment)
#5178 (comment)
#5179 (comment)
#5207 (comment)
#5234 (comment)
#5291 (comment)
#5380 (comment)
#5487 (comment)
#5494 (comment)
#5512 (comment)
#5563 (comment)
#5625 (comment)
#5723 (comment)
#5742 (comment)
#5747 (comment)
#5752 (comment)
#5780 (comment)
#5791 (comment)
#5797 (comment)
#5811 (comment)
#5872 (comment)
#5928 (comment)
#5928 (comment)
#5928 (comment)
#5935 (comment)
#5935 (comment)
#5998 (comment)
#6013 (comment)
#6036 (comment)
#6103 (comment)
#6121 (comment)
#6125 (comment)
#6177 (comment)
#6178 (comment)
#6240 (comment)
#6254 (comment)
#6276 (comment)
#6490 (comment)
#6567 (comment)
#6607 (comment)
#6624 (comment)
#6656 (comment)
#6679 (comment)
#6735 (comment)
#6771 (comment)
#6784 (comment)
#6963 (comment)
#7022 (comment)
#7056 (comment)
#7085 (comment)
#7092 (comment)
#7115 (comment)
#7159 (comment)
#7246 (comment)
#7247 (comment)
#7362 (comment)
#7364 (comment)
#7364 (comment)
#7370 (comment)
#7377 (comment)
#7420 (comment)
#7506 (comment)
#7506 (comment)
#7548 (comment)
#7556 (comment)
#7557 (comment)
#7569 (comment)
#7570 (comment)
#7596 (comment)
#7621 (comment)
#7738 (comment)
#7824 (comment)
#7856 (comment)
#7896 (comment)
#7956 (comment)
#7982 (comment)
#8001 (comment)
#8001 (comment)
#8270 (comment)
#8276 (comment)
#8300 (comment)
#8426 (comment)
#8426 (comment)
#8475 (comment)
#8489 (comment)
#8638 (comment)
#8668 (comment)
#8690 (comment)

But a proper fix would build a trie out of all golang-hg hashes from the git commits,

$ git cat-file -p 7d7c6a97f815e9279d08cfaea7d5efb5e90695a8
tree e06bd601885e16ad3d72c2a8c9b411889b2e478e
author Brian Kernighan <bwk> 80352345 -0500
committer Brian Kernighan <bwk> 80352345 -0500
golang-hg f6182e5abf5eb0c762dddbb18f8854b7e350eaeb

hello, world

R=ken
DELTA=7  (7 added, 0 deleted, 0 changed)

And then look to find any 6 or 7+ hex substring of those hg hashes.

@bradfitz bradfitz changed the title from rewrite Hg hashes in issue tracker to x/build: rewrite Hg hashes in issue tracker Jul 19, 2017

@gopherbot gopherbot added this to the Unreleased milestone Jul 19, 2017

@gopherbot gopherbot added the Builders label Jul 19, 2017

@bradfitz

This comment has been minimized.

Member

bradfitz commented Jul 19, 2017

@jaredborner

This comment has been minimized.

jaredborner commented Jul 20, 2017

i generated a csv file mapping the comments/revisions to their corresponding git commits. (the mapping was generated with git log --all --pretty=raw | awk '$1=="commit"{c=$2}$1=="golang-hg"{print $2,c}')

hg2git.matched.txt

this failed to find a commit for a few of the revisions. i think it's because they came from a different repo.

hg2git.missing.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment