Commit Graph

103 Commits

Author SHA1 Message Date
David M. Carr
7168922e8f gitrepo: initial support for listkeys
This changeset adds test coverage for comparing "hg outgoing -B" in normal
Mercurial usage with Hg-Git usage.  This didn't match, since previously, gitrepo
didn't provide a meaningful listkeys implementation.  Now, it does.

gitrepo now has access to a GitHandler when a localrepo is available.  This
handler is used to access the information needed to implement listkeys for
namespaces (currently, only bookmarks) and bookmarks.

A couple of other tests were testing "divergent bookmark" scenarios.  These
tests have been updated to filter out the divergent bookmark output, as it isn't
consistent across the supported Mercurial versions.
2012-10-25 20:49:08 -04:00
David M. Carr
92f7dd666e push: fix traceback when pushing empty hg repo to empty git repo (issue #58)
In the logic that was attempting to handle the case where the local repo doesn't
have any bookmarks, the assumption was being made that tip resolved to a
non-null revision.  In the case of a totally empty local repo, however, that
isn't a valid assumption, and resulted in attempting to set the master ref
to None, which broke dulwich.

The "fix", which avoids the traceback and allows the push to complete (though
still do nothing, since in this case there aren't any changes to push), is to
not tweak the refs at all if tip is nullid.  Leaving the special capabilities
ref and not adding a master ref appears to be fine in this case.
2012-10-25 00:40:35 -04:00
Augie Fackler
9f2907f1f1 Merge 2012-10-17 10:59:42 -05:00
Augie Fackler
f8e6ed57b8 git_handler: lazy-load mapping
Loading the mapping was costing about half a second for a user on IRC
on the pidgin repo. There's no reason to load this data aggressively.
2012-10-17 10:50:55 -05:00
David M. Carr
33ac80b524 push: change "no changes" default output to match normal mercurial
The output for "hg push" when there were no changes didn't quite match between
Mercurial with and without Hg-Git, so I changed the behavior to bring it into
synch.  The existing "creating and sending data" message was changed to be
included if --verbose is specified.
2012-10-07 20:11:27 -04:00
David M. Carr
727eff8e96 outgoing: don't delete remote refs
There was a bug introduced in fa5f235be2cd such that calling hg outgoing on
a Git repository would result in all refs being deleted from the remote
repository (with the possible exception of the currently checked out branch).
It wasn't noticed before because the existing test for outgoing didn't actually
verify the refs on the remote.  This changeset fixes the bug, as well as adding
test coverage to allow verifying that the fix works.
2012-09-27 22:32:01 -04:00
Gregory Szorc
2d6677065b Verify tree and parent objects are in Git repo
When exporting Git commits, verify that the tree and parents objects
exist in the repository before allowing the commit to be exported. If a
tree or parent commit is missing, then the repository is not valid and
the export should not be allowed.
2012-09-21 20:26:26 -07:00
Gregory Szorc
2e7c57f121 Precompile author file regular expression 2012-09-21 19:43:50 -07:00
Gregory Szorc
a8e43072e2 Precompile Git progress regular expressions 2012-09-21 19:42:24 -07:00
Gregory Szorc
19caaa42b9 Precompile Git author extra data regular expression 2012-09-21 19:39:53 -07:00
Gregory Szorc
71b136cd70 Precompile Git username sanitizing regular expression 2012-09-21 19:36:57 -07:00
Gregory Szorc
029f0a2090 Precompile Git URI regular expression 2012-09-21 19:32:16 -07:00
Gregory Szorc
7ac8f5932a Optimize get_git_author
Pre-compile regular expression. Prevent extra key lookup in author_map.
2012-09-21 19:28:46 -07:00
David M. Carr
523efe6ee9 outgoing: re-introduce support for outgoing 2012-09-13 18:47:11 -04:00
Augie Fackler
fbc67fee2e Merge master into next. 2012-09-09 16:13:02 -05:00
David M. Carr
1b832796d9 push: state when no changes are found 2012-09-05 23:27:31 -04:00
David M. Carr
050798d918 push: only output updated refs 2012-09-05 23:27:31 -04:00
David M. Carr
fb9384235f push: return 1 if no changes found, 0 if success
While working on some other tests, I noticed that the push command was returning
exit code 1 on success.  This changeset makes hgrepo.push use the same return
code contract as localrepo.push, which makes the exit codes behave as expected.
2012-09-05 23:27:31 -04:00
Augie Fackler
41c1d684a6 submodules: only use the ordereddict backport if collections.OrderedDict is unavailable 2012-08-28 09:09:01 -05:00
Augie Fackler
b67b731687 git_handler: remove tab character that snuck in 2012-08-28 09:08:22 -05:00
Mads Kiilerich
0c4f25ccd3 git_handler: fix safehasattr - hg util is hgutil 2012-08-13 18:56:27 +02:00
Artem Tikhomirov
d87f82457b Subrepos: generate .hgsubstate and .hgsub based on gitlinks and .gitmodules, preserve gitlinks on hg commit export. Tests included. Dependency from PyPI's ordereddict to use OrderedDict 2012-08-06 18:30:33 +02:00
Kevin Bullock
5ea6165dba git_handler: fix import_git_objects for Mercurial 2.0+ (issue 36)
This resolves a traceback on pull where hg-git is looking for the
nonexistent repo._tagtypes.
2012-07-04 09:39:23 -05:00
Augie Fackler
62d195c6c8 git_handler: add missing not from hg metadata extraction 2012-04-21 12:21:29 -05:00
Sean Farley
b8476fff7c git_handler: fix line.split error when bad data from a rebase is in the log 2012-03-31 13:55:06 -05:00
Mike Bayer
f764a03014 - add "author file" extension, allows an author translation map
to put more legit author names in the outgoing git repo
2012-02-23 13:49:07 -05:00
Keshav Kini
89e9168ff4 Remove illegal characters from username/email
Includes a doctest and tests in test-hg/author for the correct behavior.
2012-02-15 09:30:06 +08:00
Jason R. Coombs
c927a00fe4 Strip trailing slash for heroku-style URLs. Fixes #31. Includes a regression test for the fix. 2012-01-27 22:48:55 -05:00
Jason R. Coombs
9eee4f19dc Removed support for URLs beginning with git@. These URLs are not possible from within mercurial. 2012-01-27 13:24:31 -05:00
Jason R. Coombs
dce42e28df Simplified URL handling with a single regular expression. This change enables port declarations with colon-separated urls. 2012-01-26 22:20:31 -05:00
Augie Fackler
2d280d3dfb Update for newer dulwich and hg versions. 2012-01-27 11:06:27 -06:00
Mike Bayer
05e4d83f4b - add "branch_bookmark_names" parameter. this allows bookmarks
that mimic a branchname to be maintained on the git side without
a particular suffix - e.g. if the hg repo had a branch "release_05",
and a bookmark created onto it "release_05_bookmark", the branch on the
git side would be named "release_05".   When pulling branches back from
git, if an hg named branch of that name exists, the suffix is appended
back onto the name before creating a bookmark on the hg side.

This is strictly so that a git repo can be generated that has the
same "branch names" as an older hg repo that has named branches, and
has had bookmarks added in to mirror the branch names.
This is given the restrictions that
A. hg named branches can never be renamed and B. hg-git only supports
hg bookmarks, not branches
2011-12-18 18:54:16 -05:00
Dan Villiom Podlaski Christiansen
78c2d2b9f4 add support for the HTTP smart protocol when using Dulwich tip
I have tested this with unauthenticated pulls from
Bitbucket. Authentication appears broken; I suspect this is a
limitation in Dulwich.
2011-10-05 22:44:29 +02:00
Ehsan Akhgari
d57f385799 Improve the parsing of author lines from Mercurial to generate committer and author lines that git can correctly understand
Signed-off-by: Ehsan Akhgari <ehsan.akhgari@gmail.com>
---
I found a number of bugs when I was trying to convert Mozila's hg repository
to git using hg-git.  This patch fixes a number of bugs with irregular
author lines present in hg repositories.  Git cannot correctly process a
commit object which has a committer or author line in a format that it does
not understand, which makes it not be able to handle the repositories
with have such commit objects.

The added test cases shows the irregular cases that this patch is able to
deal with.
2011-09-09 16:12:49 -05:00
Augie Fackler
2a4f0d3a5b Adapt to atomictempfile API changes from Mercurial. 2011-09-09 16:00:52 -05:00
Augie Fackler
43c3024db6 Fix all-version-tests. 2011-07-19 08:11:02 -05:00
Augie Fackler
b54f430c7a Merge fix for hg out failing on empty repo. 2011-07-17 14:01:40 -05:00
Scott Chacon
83390977cd only want heads and tags 2011-07-15 15:33:48 -07:00
mcc
fa9b6433a8 In some situations where a reference is being used but does not exist in _map_git or _map_hg, silently skip the reference rather than throwing an error. This allows hg outgoing to work on repositories which do not contain any revisions at all. 2011-07-13 22:15:04 -07:00
Junichi OKADOME
41fa77794d to be recognized port number in path to repository 2011-07-13 17:51:16 +09:00
Augie Fackler
890facca02 test fixes for progress cleanup 2011-06-17 15:01:31 -05:00
Brendan Cully
851456bac4 Convert dulwich progress into mercurial ui.progress
Breaks most tests cosmetically, but for the better.
2011-06-15 23:40:12 -07:00
Brendan Cully
95c74ae913 Support for hg incoming 2011-05-24 11:16:45 -07:00
Christian Walther
535c79d7b1 Fix round-trip fidelity for merges of converged files. 2011-05-24 20:07:37 +02:00
César Izurieta
58c48d9319 Use author as email when it is an email 2011-05-23 19:29:33 -03:00
Adrian Sampson
4fa25100ed respect references to tags that differ between git and .hgtags 2011-05-20 22:41:43 -07:00
Brendan Cully
1182e4bbb6 pull: more conservative count of new heads
Testing against the k-9 repository I realized I am counting too many
references as changed after a pull.
2011-05-20 09:47:50 -07:00
Brendan Cully
a36df4d3a1 Make pull results more like hg pulls.
Returns the number of changed heads (refs).
Uses the same "no changes found" message.
2011-05-18 15:12:32 -07:00
Brendan Cully
001a4d567d Only fetch objects that are not already present.
fetch_pack was needlessly walking every ref even when the refs were already
known locally.
2011-05-18 00:31:40 -07:00
Brendan Cully
00fdcfbbc3 Catch GitProtocolError wherever HangupException can occur.
With recent changes to dulwich, this exception occurs in more places.
2011-05-18 00:31:40 -07:00