Ref T4195. Mercurial is not my favorite VCS.
Details
- Reviewers
btrahan - Maniphest Tasks
- T4195: Implement pre-commit Herald rules
- Commits
- Restricted Diffusion Commit
rP6f3a99eb392e: Generate ref updates in Mercurial hooks
Hit the split branches case:
>>> orbital ~/repos/INIH $ hg push --force pushing to ssh://dweller@local.aphront.com/diffusion/INIH searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 2 changesets with 2 changes to 1 files (+1 heads) remote: +---------------------------------------------------------------+ remote: | * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * | remote: +---------------------------------------------------------------+ remote: \ remote: \ ^ /^ remote: \ / \ // \ remote: \ |\___/| / \// .\ remote: \ /V V \__ / // | \ \ *----* remote: / / \/_/ // | \ \ \ | remote: @___@` \/_ // | \ \ \/\ \ remote: 0/0/| \/_ // | \ \ \ \ remote: 0/0/0/0/| \/// | \ \ | | remote: 0/0/0/0/0/_|_ / ( // | \ _\ | / remote: 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / / remote: ,-} _ *-.|.-~-. .~ ~ remote: \ \__/ `/\ / ~-. _ .-~ / remote: \____(Oo) *. } { / remote: ( (--) .----~-.\ \-` .~ remote: //__\\ \ DENIED! ///.----..< \ _ -~ remote: // \\ ///-._ _ _ _ _ _ _{^ - - - - ~ remote: remote: remote: DANGEROUS CHANGE: The change you're attempting to push splits the head of branch 'default' into multiple heads: 802c785c3dd9, e73400db39b0. This is inadvisable and dangerous. remote: Dangerous change protection is enabled for this repository. remote: Edit the repository configuration before making dangerous changes. remote: remote: transaction abort! remote: rollback completed remote: abort: pretxnchangegroup.phabricator hook exited with status 1
Hit the divergent heads case:
>>> orbital ~/repos/INIH $ hg push --force pushing to ssh://dweller@local.aphront.com/diffusion/INIH searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 1 changesets with 1 changes to 1 files (+1 heads) remote: +---------------------------------------------------------------+ remote: | * * * PUSH REJECTED BY EVIL DRAGON BUREAUCRATS * * * | remote: +---------------------------------------------------------------+ remote: \ remote: \ ^ /^ remote: \ / \ // \ remote: \ |\___/| / \// .\ remote: \ /V V \__ / // | \ \ *----* remote: / / \/_/ // | \ \ \ | remote: @___@` \/_ // | \ \ \/\ \ remote: 0/0/| \/_ // | \ \ \ \ remote: 0/0/0/0/| \/// | \ \ | | remote: 0/0/0/0/0/_|_ / ( // | \ _\ | / remote: 0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\.-~ / / remote: ,-} _ *-.|.-~-. .~ ~ remote: \ \__/ `/\ / ~-. _ .-~ / remote: \____(Oo) *. } { / remote: ( (--) .----~-.\ \-` .~ remote: //__\\ \ DENIED! ///.----..< \ _ -~ remote: // \\ ///-._ _ _ _ _ _ _{^ - - - - ~ remote: remote: remote: DANGEROUS CHANGE: The change you're attempting to push creates new, divergent heads for the branch 'default': f56af4232aa9. This is inadvisable and dangerous. remote: Dangerous change protection is enabled for this repository. remote: Edit the repository configuration before making dangerous changes. remote: remote: transaction abort! remote: rollback completed remote: abort: pretxnchangegroup.phabricator hook exited with status 1
Did a bunch of good/bad pushes:
{F89300}
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
This is pretty gross. Basically, in Mercurial you can't ever delete or overwrite a branch, but you can push a new branch head with hg push --force, so then "master" has, like, an arbitrarily large number of heads. We detect creating more heads on some branch than already exist in the repository and reject it as dangerous. Otherwise, we create update refs for all the heads, keeping track of which ones were appended to and which ones are new.
So what is your favorite VCS?
src/applications/diffusion/engine/DiffusionCommitHookEngine.php | ||
---|---|---|
443โ445 | Can you just kill this foreach? My read of this code is it runs the command twice, but this first time doesn't capture output really? |
src/applications/diffusion/engine/DiffusionCommitHookEngine.php | ||
---|---|---|
443โ445 | Oh, this should be Futures($futures). The idea is to run all of the commands in parallel. |