Commit Graph

831 Commits

Author SHA1 Message Date
Siddharth Agarwal
9cbd6b88f5 git_handler.get_git_incoming: stop setting the default for refs
Because of the previous patches, refs can never be None at this point.
2014-10-22 22:30:10 -07:00
Siddharth Agarwal
238807b3a0 git_handler.import_git_objects: require all arguments
All this function's callers now pass in all arguments.
2014-10-22 22:28:56 -07:00
Siddharth Agarwal
6d06307127 git_handler.import_commits: pass in refs explicitly
This matches the way the other callers call import_git_objects.
2014-10-22 22:26:40 -07:00
Siddharth Agarwal
08d2cd6694 git_handler: move extract_hg_metadata into git2hg
This function doesn't depend on self at all, so moving it to git2hg is
straightforward.
2014-10-15 16:54:50 -07:00
Siddharth Agarwal
e38779118a git2hg.find_incoming: move graph traversal into a function
This is preparation for upcoming changes to find_incoming that will allow it to
import certain Git branches as Mercurial named branches.
2014-10-15 14:21:09 -07:00
Siddharth Agarwal
39849eaa29 git2hg.find_incoming: move head-finding code into a function
This is preparation for upcoming changes to find_incoming that will allow it to
import certain Git branches as Mercurial named branches.
2014-10-15 12:22:03 -07:00
Siddharth Agarwal
4ab87d107f git2hg.find_incoming: drop unused 'seen' set 2014-10-15 11:52:25 -07:00
Siddharth Agarwal
33da556b19 git2hg.find_incoming: drop a comment and clarify another
The removed comment is irrelevant, and the second one confused me for a while.
2014-10-15 11:41:44 -07:00
Siddharth Agarwal
759a84820e git2hg.find_incoming: drop unnecessary if statement 2014-10-15 11:40:12 -07:00
Siddharth Agarwal
b61a1ae843 git2hg: return a struct from find_incoming
We're going to return more data from find_incoming soon. Make that easier than
parsing a tuple.
2014-10-14 16:35:37 -07:00
Siddharth Agarwal
27bf2140b3 git_handler: move get_git_incoming to a separate module
git_handler's getting far too big, and we're going to add some more git-to-hg
specific logic soon, so now seems like a good time to add a new module.
2014-10-14 15:54:58 -07:00
Siddharth Agarwal
b769e64d40 git_handler.get_git_incoming: explicitly use the Git object store
This is preparation for moving most of the code here out into a separate
module. With this patch, we can avoid passing in the entire Repo object and
just pass in the object store to the factored out function.
2014-10-15 16:41:17 -07:00
Siddharth Agarwal
8864914bc6 git_handler.git_get_incoming: move default refs init to the top
This is preparation for moving most of the code into a separate module. These
two lines will be left behind in this module.
2014-10-15 16:35:53 -07:00
Siddharth Agarwal
e13fb6fd87 git_handler: rename getnewgitcommits to get_git_incoming
getnewgitcommits isn't PEP8 and is kind of awkward -- what does 'new' mean?
2014-10-15 16:06:46 -07:00
Siddharth Agarwal
43e4b87b21 git_handler: rename convert_list to commit_cache
convert_list is not the best naming choice for this variable. It is neither a
list nor has anything to directly do with conversion -- it is simply a cache of
commit hashes to the Git objects backing them.
2014-10-14 15:21:09 -07:00
Siddharth Agarwal
11d5ec8658 git_handler: make refs a required param to getnewgitcommits
All its callers already specify this param.
2014-10-14 14:52:38 -07:00
Augie Fackler
f66dc1e1ac __init__: work around exchange not yet existing in hg 2.8.x 2014-10-14 11:32:21 -04:00
Siddharth Agarwal
34580646fc exchange: wrap push if localrepository.push isn't available
Mercurial rev 88d9d4ec499e removed localrepository.push. We don't do it the
other way round (wrap push if exchange.push is available) because that's been
available with a different signature since Mercurial 3.0.
2014-10-13 18:55:18 -07:00
Siddharth Agarwal
3d8689ca46 exchange: wrap pull if localrepository.pull isn't available
Mercurial rev 20bb6e6b4dc5 removed localrepository.pull. We don't do it the
other way round (wrap pull if exchange.pull is available) because that's been
available with a different signature since Mercurial 3.0.
2014-10-13 18:53:42 -07:00
Siddharth Agarwal
16e7862fe1 hgrepo: move _transform_notgit into util
This decorator will be used in other contexts in upcoming patches.
2014-10-13 16:26:31 -07:00
Siddharth Agarwal
58d56b6660 hgrepo: import mercurial.util as hgutil
An upcoming patch will import hg-git's util. This particular pattern is
followed throughout the hg-git codebase.
2014-10-13 16:26:23 -07:00
Siddharth Agarwal
9cc8a9705d test-bookmark-workflow: drop check for Mercurial < 2.1
We only support Mercurial >= 2.8.
2014-10-13 19:10:38 -07:00
Augie Fackler
7aedee2ea4 CONTRIBUTING: remove stray sentence fragment 2014-10-14 11:21:09 -04:00
Siddharth Agarwal
1a2929b055 git_handler.save_remote_refs: use an atomic temp file to write
This bug becomes obvious now that the code is structured like this.
2014-09-03 19:56:45 +02:00
Siddharth Agarwal
22561bae4b git_handler: move remote ref writing to a separate function
For consistency with save_map and save_tags.
2014-09-03 19:55:28 +02:00
Siddharth Agarwal
315a838922 git_handler.update_remote_branches: rename 'tags' to 'remote_refs'
'tags' is a fairly nonsensical name in this context.
2014-09-03 19:47:37 +02:00
Siddharth Agarwal
71fe850624 hgrepo: move remote ref loading to git_handler
The writing out is in the git handler, so the loading should be too.
2014-09-03 19:46:42 +02:00
Siddharth Agarwal
8a139c3cfe git_handler: convert to hex at the end instead of in the middle
This makes upcoming patches simpler.
2014-09-03 19:35:31 +02:00
Siddharth Agarwal
043b7dbe03 git_handler: move git-remote-refs out to a class field for consistency 2014-09-03 18:48:16 +02:00
Siddharth Agarwal
89bb592958 git_handler: rename tagsfile to tags_file for PEP8 compat 2014-09-03 18:47:28 +02:00
Siddharth Agarwal
630ca7513d git_handler: rename mapfile to map_file for PEP8 compat 2014-09-03 18:46:55 +02:00
Siddharth Agarwal
bae8da0932 git_handler: remove unnecessary os.path.join call 2014-09-03 18:45:18 +02:00
Siddharth Agarwal
f11a61a432 git_handler.load_map: use None as the uninitialized condition
If there are no elements in the map, we would have tried loading it over and
over again. With this, we only try loading it once.
2014-09-03 20:29:01 +02:00
Siddharth Agarwal
53fad749ea test-extra: add some more rename tests 2014-08-31 14:23:57 -07:00
Siddharth Agarwal
ed8599fcd4 git_handler: export hg extra metadata as git extra metadata (issue121)
We export new git commits with hg extra metadata stored as git extra fields.
We also ensure that parsing old commits doesn't break.
2014-08-31 14:01:07 -07:00
Siddharth Agarwal
0685b87e70 git_handler: support extracting metadata from Git extra fields
Git has a well-hidden notion of extra fields. They aren't accessible from the
CLI, but Dulwich can create them. They're a better place to store Mercurial's
extra metadata than the commit message.

An upcoming patch will switch hg-git to saving the metadata in the Git extra
fields. This commit:
(a) prepares for that
(b) extracts other Git extra fields so that commits from Git with such fields
    roundtrip correctly
2014-08-31 06:49:18 -07:00
Siddharth Agarwal
73ef101f82 tests: add support for inline python
An upcoming patch will include an inline python test. tests/heredoctest.py is
copied over from the Mercurial repository.
2014-08-31 06:27:46 -07:00
Augie Fackler
ec5ffb1707 test-extra.t: use a templater format that's portable back to hg 2.8.2 2014-08-31 09:37:28 -04:00
Augie Fackler
c67c09d71b Makefile: fix tests-3.1 to actually be tests-3.1 in all-version-tests 2014-08-31 09:37:08 -04:00
Siddharth Agarwal
553598f445 git_handler: store hg extra data in git deterministically by sorting it
Previously, we'd iterate over the extra elements in arbitrary order. We now
sort the elements and store them in deterministic order.

Without sorting, the included test fails half the time.
2014-08-31 05:13:39 -07:00
Siddharth Agarwal
6ca8cde9a9 git_handler: drop unnecessary add_extras boolean from get_git_message 2014-08-31 03:33:36 -07:00
Siddharth Agarwal
706ef1547d tests: add test to ensure hg rename and extra metadata roundtrips
We didn't actually have a test for this until now.
2014-08-30 09:29:20 -07:00
Siddharth Agarwal
5477c71065 git_handler: fix filectxfn compatibility with hg's default branch
Mercurial rev 2eef89bfd70d changed the contract for filectxfn, and rev
6c946e059d3b added a way for us to detect the change.
2014-08-30 05:48:24 -07:00
Augie Fackler
a91be10a82 Add a file with contribution guidelines. 2014-08-23 15:02:03 -04:00
Augie Fackler
21707f30e0 Mark hg 3.1 as supported as well. 2014-08-23 12:58:09 -04:00
Augie Fackler
61c4c39b9a tests: adapt for hg 3.1 output changes 2014-08-23 13:05:28 -04:00
Augie Fackler
7cda21ac0c git_handler: attempt to advertise a slightly better user-agent
This causes github to actually respect us as a git client. I still
maintain the user-agent sniffing is silly, but at least now it works.
2014-08-23 12:37:25 -04:00
Augie Fackler
74b814ef9e git_handler: drop lots of compat cruft for old dulwich versions 2014-08-23 12:36:53 -04:00
Augie Fackler
13a5ad2a4d setup: require newer dulwich so we can always pass an opener to HttpGitClient 2014-08-23 12:45:27 -04:00
Augie Fackler
f454e245e4 hgrepo: catch NotGitRepository and turn it into abort 2014-08-23 12:35:57 -04:00