Граф коммитов

124 Коммитов

Автор SHA1 Сообщение Дата
Sebastian Schuberth b8686c661d contrib: git-remote-{bzr,hg} placeholders don't need Python
It does not make sense for these placeholder scripts to depend on Python
just because the real scripts do. At the example of Git for Windows, we
would not even be able to see those warnings as it does not ship with
Python. So just use plain shell scripts instead.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-03-03 11:09:34 -08:00
Junio C Hamano b2c851a8e6 Revert "Merge branch 'jc/graduate-remote-hg-bzr' (early part)"
Instead of showing a warning and working as before, fail and show
the message and force immediate upgrade from their upstream
repositories when these tools are run, per request from their
primary author.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-20 14:48:11 -07:00
Felipe Contreras 0311086351 contrib: remote-helpers: add move warnings (v2.0)
The tools are now maintained out-of-tree, and they have a regression
in v2.0. It's better to start warning the users as soon as possible.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-05-19 17:10:03 -07:00
Junio C Hamano 8f87d548b6 Merge branch 'fc/remote-helper-fixes'
* fc/remote-helper-fixes:
  remote-bzr: trivial test fix
  remote-bzr: include authors field in pushed commits
  remote-bzr: add support for older versions
  remote-hg: always normalize paths
  remote-helpers: allow all tests running from any dir
2014-04-18 11:17:40 -07:00
Felipe Contreras 867bf7b490 remote-hg: always normalize paths
Apparently Mercurial can have paths such as 'foo//bar', so normalize all
paths.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-04-09 14:20:48 -07:00
Junio C Hamano 125d8ecefe Merge branch 'ap/remote-hg-skip-null-bookmarks'
* ap/remote-hg-skip-null-bookmarks:
  remote-hg: do not fail on invalid bookmarks
2014-04-02 14:18:23 -07:00
Max Horn 51be46ec4d remote-hg: do not fail on invalid bookmarks
Mercurial can have bookmarks pointing to "nullid" (the empty root
revision), while Git can not have references to it. When cloning or
fetching from a Mercurial repository that has such a bookmark, the
import failed because git-remote-hg was not be able to create the
corresponding reference.

Warn the user about the invalid reference, and do not advertise these
bookmarks as head refs, but otherwise continue the import. In
particular, we still keep track of the fact that the remote repository
has a bookmark of the given name, in case the user wants to modify that
bookmark.

Also add some test cases for this issue.

Reported-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-03-25 12:05:24 -07:00
Felipe Contreras e71d137879 remote-hg: fix 'shared path' path
If the repository is moved, the absolute path of the shared repository
would fail.

Make sure it's always up-to-date.

Reported-by: Michael Davis <mjmdavis@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-09 13:18:44 -08:00
Felipe Contreras 0c0ebc1fdf remote-helpers: add extra safety checks
Suggested-by: Roman Ovchinnikov <coolthecold@gmail.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-09 13:18:43 -08:00
jcb91 257ec841b8 remote-hg: avoid buggy strftime()
error on pull: fatal: Invalid raw date "" in ident: remote-hg <>

Neither %s nor %z are officially supported by python, they may work on
some (most?) platforms, but not all.

removed strftime use of %s and %z, which are not officially supported by python, with standard formats

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-09 13:18:43 -08:00
Richard Hansen 6c68a404e6 remote-bzr, remote-hg: fix email address regular expression
Before, strings like "foo.bar@example.com" would be converted to
"foo. <bar@example.com>" when they should be "unknown
<foo.bar@example.com>".

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>
2013-11-18 13:46:00 -08:00
Richard Hansen c939d24167 remote-hg: don't decode UTF-8 paths into Unicode objects
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>
2013-11-18 13:45:56 -08:00
Junio C Hamano 583736c0bc Merge branch 'ap/remote-hg-unquote-cquote'
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
2013-11-01 07:38:35 -07:00
Antoine Pelisse 1136265377 remote-hg: unquote C-style paths when exporting
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>
2013-10-23 09:45:53 -07:00
Junio C Hamano 751e2b3718 Merge branch 'fc/contrib-bzr-hg-fixes'
* 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
2013-09-18 11:45:49 -07:00
Junio C Hamano 4f5e9726e1 Merge branch 'fc/remote-hg-shared-setup'
* fc/remote-hg-shared-setup:
  remote-hg: add shared repo upgrade
  remote-hg: ensure shared repo is initialized
2013-09-04 12:36:32 -07:00
Felipe Contreras c587d65512 remote-hg: use notes to keep track of Hg revisions
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>
2013-08-30 10:37:23 -07:00
Felipe Contreras 641a2b5bee remote-helpers: cleanup more global variables
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>
2013-08-29 11:40:57 -07:00
Felipe Contreras 670dda85d6 remote-helpers: trivial style fixes
In accordance with pep8.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-29 11:40:56 -07:00
Felipe Contreras 3baacc5cc6 remote-hg: add shared repo upgrade
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>
2013-08-11 23:17:10 -07:00
Felipe Contreras 52f0856a7b remote-hg: ensure shared repo is initialized
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>
2013-08-11 23:16:59 -07:00
Antoine Pelisse 33f66b25e1 remote-hg: fix path when cloning with tilde expansion
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>
2013-08-09 15:33:02 -07:00
Felipe Contreras c9eaef125b remote-hg: add support for --force
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>
2013-05-28 08:02:25 -07:00
Felipe Contreras e3751a1763 remote-hg: add support for --dry-run
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>
2013-05-28 08:02:24 -07:00
Felipe Contreras ba091c200d remote-hg: check if a fetch is needed
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 08:02:24 -07:00
Felipe Contreras ab64bc9d21 remote-hg: trivial cleanup
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>
2013-05-28 08:02:24 -07:00
Felipe Contreras 8316d18da3 remote-helpers: improve marks usage
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>
2013-05-28 08:02:24 -07:00
Felipe Contreras 66f46aa14f remote-hg: remove files before modifications
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>
2013-05-28 08:02:23 -07:00
Felipe Contreras d462469b4d remote-hg: improve lightweight tag author
Use git's committer.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 08:02:05 -07:00
Felipe Contreras b688911a78 remote-hg: use remote 'default' not local one
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 08:02:05 -07:00
Felipe Contreras c2f7a82032 remote-hg: improve branch listing
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>
2013-05-28 08:02:05 -07:00
Felipe Contreras 611024e606 remote-hg: simplify branch_tip()
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>
2013-05-28 08:02:05 -07:00
Felipe Contreras d3c460b5b4 remote-hg: check diverged bookmarks
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>
2013-05-28 08:02:05 -07:00
Felipe Contreras 883d7be110 remote-hg: pass around revision refs
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>
2013-05-28 08:02:05 -07:00
Felipe Contreras 19a8cefc44 remote-hg: implement custom checkheads()
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>
2013-05-28 08:02:04 -07:00
Felipe Contreras 4f37bdbdb6 remote-hg: implement custom push()
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>
2013-05-28 08:02:04 -07:00
Felipe Contreras d226945471 remote-hg: only update necessary revisions
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>
2013-05-28 08:02:04 -07:00
Felipe Contreras dfcef29f2f remote-hg: force remote bookmark push selectively
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>
2013-05-28 08:02:04 -07:00
Felipe Contreras aaadca28b6 remote-hg: reorganize bookmark handling
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>
2013-05-28 08:02:04 -07:00
Felipe Contreras e6e803be79 remote-hg: add remote tests
The logic when working with a local repository is totally different from
the one where we work with a remote repository; we need to pull and push
from it.

All this logic is currently not tested at all, so let's introduce a
variable to force the remote behavior.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:57 -07:00
Felipe Contreras 731ce6cf75 remote-hg: update bookmarks when using a remote
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:56 -07:00
Felipe Contreras 91347ea3e1 remote-hg: always point HEAD to master
Mercurial always checks out the 'default' branch, so there's no point in
complicating our lives trying to do something fancier, which causes
different behavior depending on whether the repository is local or
remote.

So let's always use 'default' (which we translate to 'master'), unless
we are in hg-git mode, which expects us to use the 'master' bookmark
instead.

Also, update the tests that used to check for different checkout
behaviors to simply check that the refs are there, remove unnecessary
ones, and fix the ones that expect something different.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:30 -07:00
Felipe Contreras 63f54cf216 remote-hg: improve progress calculation
No need to manually keep track of the revision count.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:30 -07:00
Felipe Contreras 34d75e78f4 remote-hg: trivial cleanups
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:30 -07:00
Felipe Contreras 9529cce86e remote-hg: ensure remote rebasing works
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:30 -07:00
Felipe Contreras 68b1611678 remote-hg: upgrade version 1 marks
As suggested by Jed Brown; there's no need to re-import all the commits.

Cc: Jed Brown <jed@59a2.org>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:30 -07:00
Felipe Contreras 93ae203495 remote-hg: switch from revisions to SHA-1 noteids
Otherwise we won't know if revisions are replaced.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:29 -07:00
Felipe Contreras c43c06b186 remote-hg: add version checks to the marks
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:29 -07:00
Felipe Contreras e936a5d484 remote-hg: improve node traversing
We won't be able to count the unmarked commits, but we are not going to
be able to do that anyway when we switch to SHA-1 ids.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:29 -07:00
Felipe Contreras 52036431ff remote-hg: shuffle some code
In preparation to shift to SHA-1's.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-28 07:59:20 -07:00