aboutsummaryrefslogtreecommitdiff
path: root/contrib/remote-helpers
Commit message (Collapse)AuthorAge
* remote-hg: don't decode UTF-8 paths into Unicode objectsRichard Hansen2013-11-18
| | | | | | | | | | The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again. Signed-off-by: Richard Hansen <rhansen@bbn.com> Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'ap/remote-hg-unquote-cquote'Junio C Hamano2013-11-01
|\ | | | | | | | | | | | | | | | | A fast-import stream expresses a pathname with funny characters by quoting them in C style; remote-hg remote helper forgot to unquote such a path. * ap/remote-hg-unquote-cquote: remote-hg: unquote C-style paths when exporting
| * remote-hg: unquote C-style paths when exportingAntoine Pelisse2013-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-fast-import documentation says that paths can be C-style quoted. Unfortunately, the current remote-hg helper doesn't unquote quoted path and pass them as-is to Mercurial when the commit is created. This results in the following situation: - clone a mercurial repository with git - add a file with space in a directory: `>dir/foo\ bar` - commit that new file, and push the change to mercurial - the mercurial repository now has a new directory named '"dir', which contains a file named 'foo bar"' Use Python str.decode('string-escape') to unquote the string if it starts and ends with ". It has been tested with quotes, spaces, and utf-8 encoded file-names. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/contrib-bzr-hg-fixes'Junio C Hamano2013-09-18
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fc/contrib-bzr-hg-fixes: contrib/remote-helpers: quote variable references in redirection targets contrib/remote-helpers: style updates for test scripts remote-hg: use notes to keep track of Hg revisions remote-helpers: cleanup more global variables remote-helpers: trivial style fixes remote-hg: improve basic test remote-hg: add missing &&s in the test remote-hg: fix test remote-bzr: make bzr branches configurable per-repo remote-bzr: fix export of utf-8 authors
| * | contrib/remote-helpers: quote variable references in redirection targetsJunio C Hamano2013-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | Even though it is not required by POSIX to double-quote the redirection target in a variable, our code does so because some versions of bash issue a warning without the quotes. Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | contrib/remote-helpers: style updates for test scriptsJunio C Hamano2013-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the review of the main series it was noticed that these test scripts can use updates to conform to our coding style better, but fixing the style should be done in a patch separate from the main series. This updates the test-*.sh scripts only for style issues: * We do not leave SP between a redirection operator and the filename; * We change line before "then", "do", etc. rather than terminating the condition for "if"/"while" and list for "for" with a semicolon; * When HERE document does not use any expansion, we quote the end marker (e.g. "cat <<\EOF" not "cat <<EOF") to signal the readers that there is no funny substitution to worry about when reading the code. * We use "test" rather than "[". Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-hg: use notes to keep track of Hg revisionsFelipe Contreras2013-08-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep track of Mercurial revisions as Git notes under the 'refs/notes/hg' ref. This way, the user can easily see which Mercurial revision corresponds to certain Git commit. Unfortunately, there's no way to efficiently update the notes after doing an export (push), so they'll have to be updated when importing (fetching). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-helpers: cleanup more global variablesFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | | | | | | | | | | They don't need to be specified if they are not going to be set. Suggested-by: Dusty Phillips <dusty@linux.ca> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-helpers: trivial style fixesFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | | | | | | | In accordance with pep8. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-hg: improve basic testFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | | | | | | | It appears 'let' is not present in all shells. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-hg: add missing &&s in the testFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-hg: fix testFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | | | | | | | It wasn't being checked properly before; those refs never existed. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-bzr: make bzr branches configurable per-repoFelipe Contreras2013-08-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | Different repositories have different branches, some are are even branches themselves. Reported-by: Peter Niederlag <netservice@niekom.de> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-bzr: fix export of utf-8 authorsFelipe Contreras2013-08-29
| |/ | | | | | | | | | | Reported-by: Joakim Verona <joakim@verona.se> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-bzr: reuse bzrlib transports when possibleRichard Hansen2013-09-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pass a list of open bzrlib.transport.Transport objects to each bzrlib function that might create a transport. This enables bzrlib to reuse existing transports when possible, avoiding multiple concurrent connections to the same remote server. If the remote server is accessed via ssh, this fixes a couple of problems: * If the user does not have keys loaded into an ssh agent, the user may be prompted for a password multiple times. * If the user is using OpenSSH and the ControlMaster setting is set to auto, git-remote-bzr might hang. This is because bzrlib closes the multiple ssh sessions in an undefined order and might try to close the master ssh session before the other sessions. The master ssh process will not exit until the other sessions have exited, causing a deadlock. (The ssh sessions are closed in an undefined order because bzrlib relies on the Python garbage collector to trigger ssh session termination.) Signed-off-by: Richard Hansen <rhansen@bbn.com> Acked-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'fc/remote-hg-shared-setup'Junio C Hamano2013-09-04
|\ \ | | | | | | | | | | | | | | | * fc/remote-hg-shared-setup: remote-hg: add shared repo upgrade remote-hg: ensure shared repo is initialized
| * | remote-hg: add shared repo upgradeFelipe Contreras2013-08-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have an old organization (v1.8.3), and want to upgrade to a newer one (v1.8.4), the user would have to fetch the whole repository, instead we can just move the repository, so the user would not notice any difference. Also, remove other clones, so in time they get set up as shared. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Reviewed-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | remote-hg: ensure shared repo is initializedFelipe Contreras2013-08-11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 6796d49 (remote-hg: use a shared repository store) introduced a bug by making the shared repository '.git/hg', which is already used before that patch, so clones that happened before that patch, fail after that patch, because there's no shared Mercurial repo. So, instead of simply checking if the directory exists, let's always try to create an empty shared repository to ensure it's there. This works because we don't need the initial clone, if the repository is shared, pulling from the child updates the parent's storage; it's exactly the same as cloning, so we can simplify the shared repo setup this way while at the same time fixing the problem. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Reviewed-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: fix path when cloning with tilde expansionAntoine Pelisse2013-08-09
|/ | | | | | | | | | | | | | The current code fixes the path to make it absolute when cloning, but doesn't consider tilde expansion, so that scenario fails throwing an exception because /home/myuser/~/my/repository doesn't exists: $ git clone hg::~/my/repository && cd repository && git fetch Expand the tilde when checking if the path is absolute, so that we don't fix a path that doesn't need to be. Signed-off-by: Antoine Pelisse <apelisse@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'fc/remote-bzr'Junio C Hamano2013-06-11
|\ | | | | | | | | | | | | | | | | | | | | | | * fc/remote-bzr: remote-bzr: add fallback check for a partial clone remote-bzr: reorganize the way 'wanted' works remote-bzr: trivial cleanups remote-bzr: change global repo remote-bzr: delay cloning/pulling remote-bzr: simplify get_remote_branch() remote-bzr: fix for files with spaces remote-bzr: recover from failed clones
| * remote-bzr: add fallback check for a partial cloneFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: reorganize the way 'wanted' worksFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | | | If the user specified a list of branches, we ignore what the remote repository lists, and simply use the branches directly. Since some remotes don't report the branches correctly, this is useful. Otherwise either fetch the repo, or the branch. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: trivial cleanupsFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: change global repoFelipe Contreras2013-05-28
| | | | | | | | | | | | | | It's not used anyway. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: delay cloning/pullingFelipe Contreras2013-05-28
| | | | | | | | | | | | | | Until the branch is actually going to be used. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: simplify get_remote_branch()Felipe Contreras2013-05-28
| | | | | | | | | | | | | | | | No need for 'origin', it's only needed for the bzrdir 'sprout' method, which can be greatly simplified. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: fix for files with spacesFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | Set the maximum number of splits to make when dividing the diff stat lines based on space characters. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * remote-bzr: recover from failed clonesFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add support for --forceFelipe Contreras2013-05-28
| | | | | | | | | | | | | | And get rid of the remote-hg.force-push option hack. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add support for --dry-runFelipe Contreras2013-05-28
| | | | | | | | | | | | | | This needs a specific patch from Git not applied yet. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: check if a fetch is neededFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: trivial cleanupFelipe Contreras2013-05-28
| | | | | | | | | | | | | | It's better to catch the exception later on. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-helpers: improve marks usageFelipe Contreras2013-05-28
| | | | | | | | | | | | | | Always convert to strings (they are unicode because they come from JSON). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add check_push() helperFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add setup_big_push() helperFelipe Contreras2013-05-28
| | | | | | | | | | | | | | So we don't duplicate these commands. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: remove files before modificationsFelipe Contreras2013-05-28
| | | | | | | | | | | | | | Otherwise replacing a file with a directory doesn't work. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: improve lightweight tag authorFelipe Contreras2013-05-28
| | | | | | | | | | | | | | Use git's committer. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: use remote 'default' not local oneFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: improve branch listingFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | We want to show the remote heads, not the internal ones, which might have garbage. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: simplify branch_tip()Felipe Contreras2013-05-28
| | | | | | | | | | | | | | | | It simply picks the last head that is not closed, but we have a stored list of open heads. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: check diverged bookmarksFelipe Contreras2013-05-28
| | | | | | | | | | | | | | So that we can report a proper error. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: pass around revision refsFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | | | So that when a diverge is detected, we know which ref to report an error for. Also, since we are not throwing an exception, return a proper error code. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: implement custom checkheads()Felipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | The version from Mercurial is extremely inefficient and convoluted, this version achieves basically the same, at least for our purposes. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: implement custom push()Felipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | | | | | The one from mercurial does a ton of things we are not interested in, and we need some special modifications which are impossible otherwise. Most of the code is borrowed from Mercurial, and cleaned up, but should be functionally the same for our purposes, except that multiple heads are not detected. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: only update necessary revisionsFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | We don't care about the rest, and in fact, we shouldn't try to push everything, as there might be garbage from previous failed pushes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: force remote bookmark push selectivelyFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | | | If we update the 'old' node, we might be updating the remote bookmark even when our 'new' node is not related at all to what the remote has, effectively forcing an update. Let's do that only when forced push is configured. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: reorganize bookmark handlingFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | We don't need to update both internal and remote bookmarks, so let's do one or the other, and move the shared code earlier, so it's simpler. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add test for failed double pushFelipe Contreras2013-05-28
| | | | | | | | | | Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add test for big pushFelipe Contreras2013-05-28
| | | | | | | | | | | | | | With lots branches and bookmarks, non-ff, updated and new. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | remote-hg: add test for new bookmark specialFelipe Contreras2013-05-28
| | | | | | | | | | | | | | | | | | | | | | From the point of view of Mercurial, this creates a new branch head, and requires a forced push. Ideally, however, we would want it to work just like in git; new branches can be pushed without problems. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>