FMCorz / mdk

Moodle Development Kit. A collection of tools meant to make developers' lives easier.
GNU General Public License v3.0
85 stars 47 forks source link

Ability to generate persistent pull diff URLs #118

Open mudrd8mz opened 9 years ago

mudrd8mz commented 9 years ago

I will prefer if I have an option to let mdk generate diff pull URLs in persistent format, i.e. with SHA1 hashes on both sides of the ... operator.

Such URLs like https://github.com/mudrd8mz/moodle/compare/ee78814...badfeed are valid forever and they work better for later references to the issue.

mudrd8mz commented 9 years ago

In my script I used to use before switching over to mdk, I had something like this

BRANCHNAME=$(git branch 2> /dev/null | grep -e ^*\  | tr -d \*\ )
BRANCHHASH=$(git rev-parse $BRANCHNAME)

BASENAME=$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD))
BASEHASH=$(git rev-parse $BASENAME)

echo "Pull Diff URL: https://github.com/mudrd8mz/moodle/compare/$BASEHASH...$BRANCHHASH"
danpoltawski commented 9 years ago

Those persistent urls are only persistent as long as github doesn't garbage collect them - note I use that technique on cibot but know that github docs do say they will eventually gc. Actually that gives me an idea that we could add an extra field in cibot report with an explicit github diffurl (we already link to patch file).

danpoltawski commented 9 years ago

I created https://tracker.moodle.org/browse/MDLSITE-4162 for adding this sort of thing to cibot output (still useful to do this here IMO)

mudrd8mz commented 9 years ago

Do you mean that github's url .../compare/SHA1...SHA1 will stop working once the hashes are old enough or so?

danpoltawski commented 9 years ago

If the source branch has been deleted, yes, eventually they run git-gc (probably): https://groups.google.com/forum/#!topic/github/ghXxynyhj0o

mudrd8mz commented 9 years ago

But... git-gc should not affect these SHA1 based diffs because the SHA1 still points to the valid commit even after it is merged into moodle.git branch.