Commit Graph

449 Commits

Author SHA1 Message Date
Laurent Charignon
4ea775d1ba bookmarks: use bookmarks.recordchange instead of bookmarks.write if available
bookmarks.write is deprecated and it was showing warning messages in
test-hg-branch.t with the latest test runner from core mercurial. Tested with
both hg 2.8 and hg tip.
2015-12-30 10:27:24 -08:00
Sean Farley
23cf0f33f3 ssh: fix breakage again with dulwich update
dulwich 0.12.x changed the way they pass parameters around, so we reformat that
to what hg-git expects.

This is just plain ridiculous.
2015-12-14 14:38:42 -08:00
Sean Farley
37c52e3cab push: print messages from the server
Some servers, for example, Bitbucket, output helpful messages. This patch
reports the output, if any exist, to the user.
2015-12-02 17:26:20 -08:00
Sean Farley
fc82883494 init: only activate git ignore logic in reposetup
This will massively speed up 'hg status' on repos that are not git based. On my
macports repo, status went from

Before: 0m0.591s
After:  0m0.297s
2015-10-29 15:57:17 -07:00
Siddharth Agarwal
cfe9c6dc8a Backed out changeset 3df4d529a2f2
This was causing test-encoding.t to fail.
2015-12-01 10:19:50 -08:00
Augie Fackler
28aa302374 git_handler: work around dulwich using unicode for ref names
Dulwich treats ref names internally as unicode strings (probably
because of Python 3?), which means that at some points it tries to do
os.path.join between the repo path and the unicode of the ref name,
which fails miserably if we construct the repo with a str and not a
unicode. Kludge around this problem.

Fixes issue 172.
2015-11-25 17:52:59 -05:00
Siddharth Agarwal
6993d261f6 determine_wants: deal with refs being None
Not clear how this is happening, but this should fix it.

Resolves issue #166.
2015-11-08 21:56:38 -08:00
Siddharth Agarwal
bc11bc247c version: bump up to 0.8.3 2015-11-08 21:41:43 -08:00
Siddharth Agarwal
0daa287392 mark as compatible with Mercurial 3.6 2015-11-08 21:39:00 -08:00
Siddharth Agarwal
3c1f8f5111 push: fix exchangepush for Mercurial 3.2 2015-11-08 21:37:48 -08:00
Durham Goode
fb8f4a418b push: fix exchangepush wrapping
Upstream added opargs to exchange.push and uses it as kwargs to the
pushoperation constructor (59da9543ec6c). There was an attempt to fix this in
hggit (2eb4c0de6bc6) but it passes the exchange.push kwargs directly to
pushoperation(), where we actually need to pull out the opargs and pass them as
kwargs.
2015-10-26 16:00:55 -07:00
Sean Farley
4e3fe9c32a ssh: fix breakage with dulwich update
dulwich 0.11.x changed the way they pass parameters around, so we reformat that
to what hg-git expects.
2015-10-19 11:41:06 -07:00
Sean Farley
8edc804959 hggit: adapt push wrapper function for recent hg
We can just accept-and-forward kwargs, which should be nicely
futureproof for a while.
2015-10-15 13:55:30 -07:00
Sean Farley
2c0ba03a59 init: wrap hgutil.url so that we can use isgitsshuri
Previously, cloning from a git ssh uri (e.g. git@github.com:user/repo.git)
would prepend the local file path because Mercurial classifies this as a path
(since there is no scheme at the beginning of the string). This patch fixes
that by doing the same logic as before in hgutil.url so that the correct hgrc
path is written.
2015-10-15 16:04:15 -07:00
Sean Farley
d11745bc53 revsets: use baseset instead of raw list
We fallback to using a standard set if baseset is not available
2015-09-24 16:54:47 -07:00
Durham Goode
5aff23b3c8 paths: mark git repos as valid paths
The latest version of Mercurial validates that a path contains the .hg
directory. This breaks when pulling/pushing to git repos.

This patch makes a gitrepo a valid path as well.
2015-08-24 19:31:52 -07:00
Durham Goode
43376aba98 paths: refactor gitdir detection to a function
Refactors the logic that decides if a local directory is a git directory into a
separate function. This will let us use it later on to integrate with
Mercurial's new paths component.
2015-08-24 19:30:44 -07:00
Sean Farley
12c6012084 update_hg_bookmarks: add wlock 2015-09-24 16:24:27 -07:00
Sean Farley
22991894df git_handler: rename local variable to not shadow import name 2015-05-14 15:15:37 -07:00
Sean Farley
beecd28ea0 git_handler: remove pre-2.8 code for bookmarks 2015-05-15 14:02:55 -07:00
Sean Farley
ef7fa85796 push: use unfiltered repo for looking previously mapped nodes
It looks like this is the only place where this could happen via this
map_hg_get function.
2015-04-27 16:51:27 -07:00
Sean Farley
39fa028455 refs: avoid using dulwich to load refs
We avoid using dulwich's refs method because it is incredibly slow. On a repo
with a few hundred branches and a few thousand tags, dulwich took about 200ms
to load everything.

This patch only traveses the remote ref directory and cuts that time down to
about 50ms.
2015-09-24 14:06:36 -07:00
Sean Farley
6bc1a87edc refs: use dulwich to read remote refs
It is unclear to me why we keep a file (which can become out of sync) of remote
refs instead of just using dulwich. This caught a missing remote ref in the
test suite.
2015-05-16 19:43:26 -07:00
Yuya Nishihara
d9061cc274 help: ignore argument passed to doc loader
The API changed at Mercurial da52575e3613.
2015-09-30 22:14:36 +09:00
Augie Fackler
e2d23a1df8 version: bump to 0.8.2 2015-08-11 17:24:03 -04:00
Sean Farley
a759c02688 init: fix default hg breakage by returning the right type
Originally, I copied the logic for the file scheme which calls
_peerlookup(path) but in mercurial/hg.py they have:

    try:
        return thing(path)
    except TypeError:
        return thing

So, our http(s) scheme broke default Mercurial because I tried returning
thing(path) instead of just thing. A test has been added to catch this.
2015-07-17 11:25:00 -07:00
Sean Farley
74ba2fc128 init: test for git http(s) paths
Wraps the http(s) schemes to test for a .git at the end of the url.
2015-06-26 16:36:39 -07:00
Sean Farley
39d59547c5 init: test for raw git ssh paths 2015-06-26 16:35:41 -07:00
Sean Farley
4d5f0b97d4 git_handler: test for a raw git ssh uri
By testing the uri early, we can reuse logic later in the method to parse the
git uri. We rely on the isgitsshuri heuristic to return True or False, and if
True, prepend 'git+ssh://' to the uri.

Arguably, this is fragile, and am open to better ideas, but can't think of
anything else currently.
2015-06-26 16:32:20 -07:00
Sean Farley
e2c674532c gitrepo: use isgitsshuri in islocal 2015-06-26 16:27:11 -07:00
Sean Farley
52aee01bcf util: add heuristic method to determine if a uri is git
This add the ability to copy & paste from github's (and other git-style) urls.
Due to how we need to handle this, we need to also ensure that paths that end
with .git are stripped of their extension.
2015-07-01 13:55:59 -07:00
Sean Farley
559877bd3b init: sort imports and clean up pep warnings 2015-06-30 15:20:06 -07:00
Sean Farley
96e32e85c0 import_git_commit: skip hgsubstate logic if file was deleted
Previously, there was an edge case for Git repositories that started as
Mercurial repositories and had used subrepos where a deleted .hgsubstate would
be ignored and therefore reintroduced.

This patch fixes that behavior by checking for the deleted .hgsubstate file
first.

A test has been added to verify behavior.
2015-06-13 18:03:34 -07:00
Durham Goode
594789d17b gitimport: add save frequency config
If the importer encountered an error half way through a large import, all the
commits are saved, but the mapfile is not written, so the process starts over
from the beginning when run again.

This adds the option for a config value that will save the map file every X
commits. I thought about just hard coding this to 100 or something, but doing it
this way seems a little less invasive.
2015-06-11 13:56:16 -07:00
Durham Goode
abb733905a pull: consider remotes during discovery
The default dulwich graph walker only walks from refs/heads. During the
discovery phase of fetching this causes it to redownload commits that are only
referenced by refs/remotes. In a normal hggit case, this seems to mean it
redownloads the entire git repo on every hg pull.

Added a --debug to a test to check the object count (it decreased from 21 to 10
as part of this patch).
2015-06-23 20:17:10 -07:00
Augie Fackler
d7b4c70b92 hggit: adapt pull wrapper function for recent hg
We can just accept-and-forward kwargs, which should be nicely
futureproof for a while.
2015-06-18 16:42:13 -04:00
anatoly techtonik
81bb3feb82 Add version info to hggit for "hg --version -v"
getversion() also reports dulwich version
2015-03-17 15:05:00 +03:00
Yuya Nishihara
0cdf33ea57 gitdirstate: eliminate naked except clause in compatibility code
Tested with Mercurial 2.8.2, 2.9.2, e7caebd40c68 (stable) and
513aeb4ef454 (default).
2015-05-31 13:54:15 +09:00
Yuya Nishihara
4c08edb7cb ignore: evaluate ignore.readpats to see if ignore module really exists
Otherwise ImportError wouldn't be raised thanks to demandimport.

Perhaps tests passed at 4b0ecb5952a6 because we are likely to have ignore.pyc
in our mercurial tree.
2015-05-31 13:51:42 +09:00
Durham Goode
ad625d9971 ignore: update ignore logic to match upstream
Upstream mercurial has dropped the ignore module and replaced it with 'include:'
patterns. Let's do the same in hggit.

Ran tests against Mercurial latest (61a01892dd10) and Mercurial 3.4.
2015-05-28 12:40:49 -07:00
Gregory Szorc
c0465bda87 git_handler: properly handle paths when files converge
filectx.renamed() returns a 2-tuple or None. memfilectx.__init__ expects
the copied argument to be either None or a string. Before, we were
passing a 2-tuple, leading to the memfilectx storing the wrong type.
This eventually resulted in doing a key lookup against a manifest
with a 2-tuple, which made manifest.c throw an error.
2015-05-14 12:51:37 -07:00
Sean Farley
057929f2ba git_handler: update for bookmark changes in mercurial 3.5 2015-05-12 17:05:13 -07:00
Siddharth Agarwal
4c89f40263 init: mark hg-git as compatible with Mercurial 3.4
Note that one test still fails with 3.4 -- however, it is a bug in core
Mercurial, only affects edge cases (broken symlinks) in the test, and is fixed
in upstream stable.
2015-05-08 15:51:45 -07:00
Siddharth Agarwal
178e6c9bdb overlaychangectx: use overlayrevlog logic to determine parents
The old logic was broken -- it didn't work at the boundary between hg and git
commits. The logic in overlayrevlog.parents handles that correctly.

This is the last fix required for Mercurial 3.4.
2015-05-08 15:50:48 -07:00
Siddharth Agarwal
fa1f56923a overlay: adapt diff to work with lazymanifests 2015-05-08 16:00:45 -07:00
Augie Fackler
c1d5202a78 pull: acquire wlock before lock to fix lock-checker warnings 2015-04-29 18:03:03 -04:00
Sean Farley
7f080a40f6 overlay: flake8 cleanup 2015-04-22 16:41:38 -07:00
Sean Farley
76f530f942 overlay: remove method that apparenetly was never called
This method had a syntax error that would have caused a crash.
2015-04-22 16:40:45 -07:00
Sean Farley
3b19ebc41e hg2git: flake8 cleanup 2015-04-22 16:42:48 -07:00
Sean Farley
89740bc8a4 gitdirstate: flake8 cleanup 2015-04-22 16:34:25 -07:00