Commit Graph

345 Commits

Author SHA1 Message Date
Siddharth Agarwal
b8dd01725f pull: support git.mindate 2014-10-29 19:37:10 -07:00
Siddharth Agarwal
b1306a0d26 git_handler: introduce a function and config to filter by minimum date
This is useful if there's no desire to import old Git branches, but new ones
should be.
2014-10-29 19:36:33 -07:00
Siddharth Agarwal
079686eb01 git_handler: support wildcards for Git branch name matching
This is quite similar to syntax Git supports. In the future maybe core
Mercurial could be extended to support this, but I think this independently
makes sense in hg-git.
2014-10-31 11:14:35 -07:00
Siddharth Agarwal
52c656bd2b git_handler.filter_refs: sort returned refs if none are provided
Again, no direct impact in stock hg-git, but super useful for extensions.
2014-10-31 10:46:56 -07:00
Siddharth Agarwal
79e05f3138 git_handler: return filtered refs as an OrderedDict
This actually has no direct impact here, but it allows extensions to customize
the list of filtered refs and be sure of the order in which they'll be
processed.
2014-10-31 10:40:58 -07:00
Siddharth Agarwal
3dc9407916 git_handler.fetch: remove dead remoteref function 2014-10-29 16:27:55 -07:00
Siddharth Agarwal
5953bb2058 git_handler: remove now-unused local_heads method 2014-10-29 12:44:29 -07:00
Siddharth Agarwal
d3891945ec git_handler.get_changed_refs: remove now-unused all_heads variable 2014-10-29 13:12:43 -07:00
Siddharth Agarwal
f842185378 git_handler.get_chanaged_refs: use exportable for no-ref check
The comment was actually incorrect -- we only used to care about bookmarks. Now
we also care about tags.
2014-10-29 13:12:15 -07:00
Siddharth Agarwal
c45d7ddd88 git_handler.get_changed_refs: switch to using get_exportable
This also means we get to clean up a lot of the code around here. It isn't
really feasible to break this up into several commits because the assumptions
in the old calling code are too closely tied to the old local_heads() way of
doing things.
2014-10-29 12:30:23 -07:00
Siddharth Agarwal
9ba36983dc git_handler.update_references: switch to using get_exportable 2014-10-29 10:35:36 -07:00
Siddharth Agarwal
ac94e84bc4 git_handler: add a way to get all heads that can be exported to Git
This is a replacement for local_heads and code duplication around it.
Centralizing all this logic also makes it much easier for extensions to define
other sorts of refs.
2014-10-29 11:56:31 -07:00
Siddharth Agarwal
3c2e5f8eb5 git_handler.get_changed_refs: drop support for ancient Mercurial versions 2014-10-29 13:30:18 -07:00
Siddharth Agarwal
82feaa76ca git_handler: write inequality more idiomatically 2014-10-27 21:47:24 -07:00
Siddharth Agarwal
cbe0340be6 git_handler.update_references: use iteritems 2014-10-28 19:03:54 -07:00
Siddharth Agarwal
1cb0a757d0 git_handler.update_references: use git ref returned from local_heads 2014-10-28 19:02:00 -07:00
Siddharth Agarwal
764c17d49f git_handler.local_heads: return git ref with sha
This allows extensions to add other sources of git refs.

The returned git ref is currently unused -- the following patch will use it.
2014-10-28 18:53:52 -07:00
Siddharth Agarwal
c2dd416ed0 git_handler.update_references: fix variable name 2014-10-28 18:57:33 -07:00
Siddharth Agarwal
da516f8757 git_handler.get_changed_refs: drop unnecessary computation of local heads
It doesn't change between iterations of the generator expression, and it's
non-trivial to calculate.
2014-10-28 18:45:02 -07:00
Siddharth Agarwal
ed9cbd422d git_handler.local_heads: use a generator comprehension
The list comprehension is unnecessary.
2014-10-28 18:25:57 -07:00
Siddharth Agarwal
713c2fd8f9 git_handler.local_heads: drop compat for ancient Mercurial versions 2014-10-28 18:22:56 -07:00
Siddharth Agarwal
350bf8df58 git_handler.import_git_commit: drop double setting of extra['branch']
This is set again just a few lines above.
2014-10-15 20:22:45 -07:00
Siddharth Agarwal
0ccc760fef git2hg.extract_hg_metadata: use None as default branch value
Using False for this is just weird.
2014-10-15 17:33:54 -07:00
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
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