Update-checkout --dump-hashes improvements

For those who may be unaware, update-checkout has for some time had an option called --dump-hashes. The intention behind the option was to provide a way to quickly dump the current hashes of all of the local repos in a manner that can be pasted quickly into a bug report. An example of the old dump-hashes output is the following:

cartan:solon gottesmm$ ./swift/utils/update-checkout --dump-hashes
clang                              773ac0251a Merge remote-tracking branch 'origin/swift-4.2-branch' into stable
cmark                              d875488 Merge pull request #4 from llvm-beanz/generate-cmark-exports
compiler-rt                        54bffdc6e Merge remote-tracking branch 'origin/swift-4.2-branch' into stable
llbuild                            606290e Removed vim and corrected comments
lldb                               197e7093dd Merge pull request #788 from fredriss/dev/dangling-persistent-state
llvm                               a4d539e482c For transitory purposes, define LLVM_DEBUG to be the same as DEBUG (#104)
ninja                              253e94c v1.8.2
swift                              b6f4bede91e [arc-codemotion] Eliminate retains that we move next to fatalErrors and unreachables.
swift-corelibs-foundation          b2b14cc6 Merge pull request #1618 from compnerd/shared-blocks
swift-corelibs-libdispatch         5f49e8b Merge pull request #387 from ktopley-apple/ktopley-dispatch-rdar40951342
swift-corelibs-xctest              11b22e5 Merge pull request #217 from compnerd/extension
swift-integration-tests            e882c92 Disable swift-build-self-host test
swift-xcode-playground-support     f2e299a Merge pull request #26 from cwakamo/fix-large-sets

While this looks pretty it turned out to not be as useful as intended since there wasn't a good automated way to checkout each commit in the relevant repo. Recently in https://github.com/apple/swift/commit/aa4bd9c14d9f5238cff9069301222f4b7846f405, I fixed this by changing --dump-hashes to instead output to stdout an update-checkout configuration file that contains a scheme called "repro" with the current local hashes. This allows one to reproduce someone else's setup by passing in the config file to update-checkout, e.x.:

$ ./swift/utils/update-checkout --config=repro.json --scheme=repro

update-checkout will understand the configuration file and checkout all of the relevant hashes. A quick example of the output from my local machine.

$ ./swift/utils/update-checkout --dump-hashes
{
    "https-clone-pattern": "https://github.com/%s.git", 
    "ssh-clone-pattern": "git@github.com:%s.git", 
    "repos": {
        "compiler-rt": { "remote": { "id": "apple/swift-compiler-rt" } }, 
        "llvm": { "remote": { "id": "apple/swift-llvm" } },
        "swift-xcode-playground-support": { "remote": { "id": "apple/swift-xcode-playground-support" } },
        "swift-corelibs-foundation": { "remote": { "id": "apple/swift-corelibs-foundation" } }, 
        "clang": { "remote": { "id": "apple/swift-clang" } }, 
        "llbuild": { "remote": { "id": "apple/swift-llbuild" } }, 
        "cmark": { "remote": { "id": "apple/swift-cmark" } }, 
        "lldb": { "remote": { "id": "apple/swift-lldb" } }, 
        "swift-corelibs-xctest": { "remote": { "id": "apple/swift-corelibs-xctest" } }, 
        "ninja": { "remote": { "id": "ninja-build/ninja" } }, 
        "swift-integration-tests": { "remote": { "id": "apple/swift-integration-tests" } }, 
        "swiftpm": { "remote": { "id": "apple/swift-package-manager" } }, 
        "swift": { "remote": { "id": "apple/swift" } }, 
        "swift-corelibs-libdispatch": { "remote": { "id": "apple/swift-corelibs-libdispatch" }   }
    }, 
    "branch-schemes": {
        "repro": {
            "repos": {
                "compiler-rt": "54bffdc6e0100a7edaa29a2e063f48f8fc1a876c", 
                "llvm": "a4d539e482ca76290f3db6b775203ae230b34d42", 
                "swift-xcode-playground-support": "f2e299a37eb6531918b6c9ce7f555b54d68d92d4", 
                "swift-corelibs-foundation": "b2b14cc60e717a1e00112dcd83faac050093f233", 
                "clang": "773ac0251a7ea94c0b58d96353d4210a7eb2aeef", 
                "llbuild": "606290e324972aa71379d3de725682b593bf0419", 
                "cmark": "d875488a6a95d5487b7c675f79a8dafef210a65f", 
                "lldb": "197e7093dde90e44fa25ec05914c9e06595565fd", 
                "swiftpm": "353522ab8cc9ae36ca68581f6faf03f7848c6d9a", 
                "swift-corelibs-xctest": "11b22e5ed8d6ffc2734810ae6d3b56160092745b", 
                "ninja": "253e94c1fa511704baeb61cf69995bbf09ba435e", 
                "swift-integration-tests": "e882c92e1f063f5971f11c4163414fd75356f521", 
                "swift": "b6f4bede91ed9b8245d86bdb4f768cc5c16b337e", 
                "swift-corelibs-libdispatch": "5f49e8bd1403757da08a685cea9c276ccdd09b75"
            }, 
            "aliases": [
                "repro"
            ]
        }
    }
}
7 Likes