##// END OF EJS Templates
exchange: ensure all outgoing subrepo references are present before pushing...
exchange: ensure all outgoing subrepo references are present before pushing We've run into occasional problems with people committing a repo, and then amending or rebasing in the subrepo. That makes it so that the revision in the parent can't be checked out, and the problem gets propagated on push. Mercurial already tries to defend against this sort of dangling reference by pushing *all* subrepo revisions first. This reuses the checks that trigger warnings in `hg verify` to bail on the push unless using `--force`. I thought about putting this on the server side, but at that point, all of the data has been transferred, only to bail out. Additionally, SCM Manager hosts subrepos in a location that isn't nested in the parent, so normal subrepo code would complain that the subrepo is missing when run on the server. Because the push command pushes subrepos before calling this exchange code, a subrepo will be pushed before the parent is verified. Not great, but no dangling references are exchanged, so it solves the problem. This code isn't in the loop that pushes the subrepos because: 1) the list of outgoing revisions is needed to limit the scope of the check 2) the loop only accesses the current revision, and therefore can miss subrepos that were dropped in previous commits 3) this code is called when pushing a subrepo, so the protection is recursive I'm not sure if there's a cheap check for the list of files in the outgoing bundle. If there is, that would provide a fast path to bypass this check for people not using subrepos (or if no subrepo changes were made). There's probably also room for verifying other references like tags. But since that doesn't break checkouts, it's much less of a problem. Differential Revision: https://phab.mercurial-scm.org/D7616

File last commit:

r35587:96421278 default
r44365:4b7d5d10 default
Show More
Cargo.toml
35 lines | 898 B | text/plain | TOMLLexer
[package]
name = "hgcli"
version = "0.1.0"
authors = ["Gregory Szorc <gregory.szorc@gmail.com>"]
license = "GPL-2.0"
build = "build.rs"
[[bin]]
name = "hg"
path = "src/main.rs"
[features]
# localdev: detect Python in PATH and use files from source checkout.
default = ["localdev"]
localdev = []
[dependencies]
libc = "0.2.34"
# We currently use a custom build of cpython and python27-sys with the
# following changes:
# * GILGuard call of prepare_freethreaded_python() is removed.
# TODO switch to official release when our changes are incorporated.
[dependencies.cpython]
version = "0.1"
default-features = false
features = ["python27-sys"]
git = "https://github.com/indygreg/rust-cpython.git"
rev = "c90d65cf84abfffce7ef54476bbfed56017a2f52"
[dependencies.python27-sys]
version = "0.1.2"
git = "https://github.com/indygreg/rust-cpython.git"
rev = "c90d65cf84abfffce7ef54476bbfed56017a2f52"