We now cache the output of `git config --list` for each of our
GitConfig instances in a Python pickle file. These can be read
back in using only the Python interpreter at a much faster rate
than we can fork+exec the git config process.
If the corresponding git config file has a newer modification
timestamp than the pickle file, we delete the pickle file and
regenerate it. This ensures that any edits made by the user
will be taken into account the next time we consult the file.
This reduces the time for a no-op repo sync from 0.847s to 0.269s.
Signed-off-by: Shawn O. Pearce <sop@google.com>
In the case of:
[url "Foo"]
insteadOf = Bar
We should return "Bar" for the key "url.Foo.insteadof", but not
for the key "url.foo.insteadof". This requires splitting the
key into its components and only lower casing the section and
value name, leaving the subsection portion alone.
Signed-off-by: Shawn O. Pearce <sop@google.com>
If the user has multiple projects to upload changes to, and they
are all going to the same review server, we only need to query the
'/ssh_info' data once.
Signed-off-by: Shawn O. Pearce <sop@google.com>
If /ssh_info is protected by an HTML based login page, we may get
back a "200 OK" response from the server with some HTML document
asking us to authenticate. This can't be parsed into a host name
and port number, so we shouldn't even try.
Valid host names and decimal port numbers cannot contain '<', but
an unexpected HTML login page would. So we test for '<' to give
us a fair indicator that the content isn't what we think it is,
and bail out.
Signed-off-by: Shawn O. Pearce <sop@google.com>
If a review URL is set to 'http://host/Gerrit' because the user
thinks that is the correct way to point repo at Gerrit, we should
be a bit more flexible and fix the URL by dropping the '/Gerrit'
suffix and replace it with '/ssh_info'.
Likewise, if a review URL points already at '/ssh_info' for a Gerrit
instance, we should leave it alone.
Signed-off-by: Shawn O. Pearce <sop@google.com>
In Gerrit2 uploads are sent over "git push ssh://...", as this
is a more efficient transport and is easier to code from external
scripts and/or direct command line usage by an end-user.
Gerrit1's HTTP POST based format is assumed if the review server
does not have the /ssh_info URL available on it.
Signed-off-by: Shawn O. Pearce <sop@google.com>
This way "forks" of a project, e.g. the linux kernel, can be setup to
use different destination projects in the review server by creating
different remotes in the client side Git repository.
Signed-off-by: Shawn O. Pearce <sop@google.com>
The mirror option downloads a complete forrest (as described by the
manifest) and creates a replica of the remote repositories rather
than a client working directory. This permits other clients to
sync off the mirror site.
A mirror can be positioned in a "DMZ", where the mirror executes
"repo sync" to obtain changes from the external upstream and
clients inside the protected zone operate off the mirror only,
and therefore do not require direct git:// access to the external
upstream repositories.
Signed-off-by: Shawn O. Pearce <sop@google.com>