Commit Graph

464 Commits

Author SHA1 Message Date
Siddharth Agarwal
f82134e252 listkeys: while looking for bookmarks, don't fetch a pack
hg pull calls listkeys for bookmarks. This would previously cause a pack with
all refs to be fetched. For Mercurial mirrors of Git repositories where only
some refs were mirrored, this would cause problems in a bunch of ways:

- A larger pack would be fetched than necessary.
- The final refs written out to the Git repo would only be the set of refs we
  were actually interested in. If a GC was subsequently run, unreferenced
  objects would be deleted. Those objects might be referred to on subsequent
  fetches, which could cause hg-git to crash.

We replace all that logic with a simple null fetch. The tests introduced in the
previous patch ensure no regressions.
2014-05-08 20:18:06 -07:00
Siddharth Agarwal
8fbad9ff16 filter_refs: only return all refs when heads is None
We're going to pass in an empty list to this function in an upcoming patch,
with the intent that filter_refs returns an empty dict.
2014-05-08 19:30:38 -07:00
Siddharth Agarwal
4587ed225c revset_fromgit: use repo.changelog.node instead of contexts
hg perfrevset 'max(fromgit())' on a repo with around 60,000 commits:

before: ! wall 1.055093 comb 1.050000 user 1.050000 sys 0.000000 (best of 10)
after:  ! wall 0.148586 comb 0.140000 user 0.140000 sys 0.000000 (best of 62)

In reality, perfrevset doesn't clear the Git-to-Mercurial map, which means that
a call like `hg log -r 'max(fromgit())'` speeds up from around 1.5 seconds to
0.6.
2014-04-14 21:05:13 -07:00
Siddharth Agarwal
ccfe0b660e revset_gitnode: use repo.changelog.node instead of contexts
For a repository with around 60,000 commits, perfrevset for gitnode becomes:
before: ! wall 1.130716 comb 1.130000 user 1.130000 sys 0.000000 (best of 9)
after:  ! wall 0.178828 comb 0.180000 user 0.180000 sys 0.000000 (best of 54)

In reality, perfrevset doesn't clear the Git-to-Mercurial map, which means that
a call like `hg log -r 'gitnode(...)'` speeds up from around 1.5 seconds to
0.6.
2014-04-14 19:32:17 -07:00
Siddharth Agarwal
c188adb4b9 hg2git: in _init_dirs, store keys without leading '/' (issue103)
Previously, whenever a tree that wasn't the root ('') was stored, we'd prepend
a '/' to it. Then, when we'd try retrieving the entry, we'd do so without the
leading '/'. This caused data loss because existing tree entries were dropped
on the floor. Fix that by only adding '/' if we're adding to a non-empty
initial path.

This wasn't detected in tests because most of them deal only with files in the
root and not ones in subdirectories.
2014-03-25 11:11:04 -07:00
Siddharth Agarwal
f84c69b6c1 hg2git: start incremental conversion from a known commit
Previously, we'd spin up the Mercurial incremental exporter from the null
commit and build up state from there. This meant that for the first exported
commit, we'd have to read all the files in that commit and compute Git blobs
and trees based on that.

The current Mercurial to Git conversion scheme makes most sense with
Mercurial's current default storage format, where manifests are diffed against
the numerically previous revision. At some point in the future, the default
will switch to generaldelta, where manifests would be diffed against one of
their parents. In that world it might make more sense to have a stateless
exporter that diffed each commit against its generaldelta parent and calculated
dirty trees based on that instead. However, more experiments need to be done to
see what export scheme is best.

For a repo with around 50,000 files, this brings down an incremental 'hg
gexport' of one commit from 18 seconds with a hot file cache (and tens of
minutes with a cold one) to around 2 seconds with a hot file cache.
2014-03-14 20:45:09 -07:00
Siddharth Agarwal
fe5bb48ac2 git_handler: return early when no commits need to be exported
This will make our life easier in an upcoming patch.
2014-03-14 19:18:19 -07:00
Siddharth Agarwal
e5bd941852 hg2git: implement a method to initialize _dirs from a Git commit
Upcoming patches will start incrementally exporting from a particular commit
instead of from null. This function will be used for that..
2014-03-14 19:17:09 -07:00
Siddharth Agarwal
3e13ddc73e safebranchrevs: handle changelog having no commits
The usage of getattr was unsafe. Use hgutil.safehasattr instead.
util.safehasattr has been around since Mercurial 2.0.

This also fixes the formerly disabled test in test-pull.t.
2014-03-04 23:20:50 -08:00
Siddharth Agarwal
bf45b40ca3 git_handler.fetch: only import commits reachable from requested heads
Previously we'd attempt to import every single reachable commit in the Git
object store.

The test adds another branch to the Git repo and doesn't import it until much
later. Previously we'd import it when we ran `hg -R hgrepo pull -r beta`. Now
we won't.
2014-03-04 16:23:11 -08:00
Siddharth Agarwal
759062fbfd git_handler.fetch: actually return number of heads added or removed
The return value as implemented in git_handler.fetch was pretty bogus. It used
to return the number of values that changed in the 'refs/heads/' namespace,
regardless of whether multiple values in there point to the same Mercurial
commit, or whether particular heads were even imported. Fix all of that by
using the actual heads in the changelog, just like vanilla Mercurial.

The test output changes demonstrate examples where the code was buggy.
2014-03-04 16:05:19 -08:00
Siddharth Agarwal
0428a10ad5 import_git_objects: return number of commits imported
This will be used in an upcoming patch.
2014-03-04 16:51:43 -08:00
Siddharth Agarwal
e41aded84e git_handler: base 'no changes found' message on commits, not on heads
Since Mercurial is commit-oriented, the 'no changes found' message really
should rely on what new commits are in the repo, not on new heads. This also
makes an upcoming patch much simpler.

Since everything around this code is completely broken anyway, writing a test
for this that doesn't trigger other bugs is close to impossible. An upcoming
patch will include tests.

The test output change is for an empty clone -- the output is precisely how
vanilla Mercurial treats an empty clone.
2014-03-04 15:43:54 -08:00
Siddharth Agarwal
636c9670c6 update_hg_bookmarks: don't update bookmarks that don't have an hg commit
Still more bugs to fix.
2014-03-04 14:50:44 -08:00
Siddharth Agarwal
c090d035ea update_remote_branches: don't store refs that don't have an hg equivalent
Same reasoning as previous patch, and same reason why this patch doesn't
include a test.
2014-03-04 14:39:50 -08:00
Siddharth Agarwal
82ef213bf9 import_tags: don't import tags that don't have an hg commit equivalent
The theme of this and upcoming patches is that relying on self.git.object_store
to figure out which commits/tags/bookmarks to import is not great. This breaks
if the git repo is manually put in place (as might be done in a server-based
replication scenario), or if a partial fetch pulled too many commits in for
whatever reason. Indeed we were just about always pulling an entire pack in,
because listkeys for bookmarks currently calls fetch_pack without any
filtering. (This is probably a bug and should be fixed, but this series doesn't
do that.)

Instead, rely on whether we actually imported the commit into Mercurial to
determine whether to import the tag. This is clean, straightforward, and
clearly correct.

There is a whole series of bugs in this code that any test case for this would
hit -- an upcoming patch will include a test for all these bugs at once.
2014-03-04 14:26:30 -08:00
Siddharth Agarwal
6a6f93d8e3 determine_wants: factor ref filtering code out into a separate function
This will be used in another context in an upcoming patch.
2014-03-04 12:57:37 -08:00
Siddharth Agarwal
4877843f03 git_handler: don't write out objects if already in object store
object_store.add_object doesn't check to see if the object is already in a
pack, so it is still written out in that case. Do the check ourselves before
calling add_object.
2014-03-03 22:44:09 -08:00
Siddharth Agarwal
05dde62bce extsetup: use new-style extsetup with ui parameter
The "new-style" extsetup has been supported since at least 2009.
2014-02-27 17:20:31 -08:00
Augie Fackler
e1793c2341 verify: drop broken and unused import statement 2014-03-01 09:37:26 -05:00
Siddharth Agarwal
89c409af60 verify: add new command to verify the contents of a Mercurial rev
Since the Git to Mercurial conversion process is incremental, it's at risk of
missing files, or recording files the wrong way, or recording the wrong commit
metadata. Add a command called 'gverify' that can verify the contents of a
particular Mercurial rev against the corresponding Git commit.

Currently, this is limited to checking file names, flags and contents, but this
can be made as robust as desired. Further additions will probably require
refactoring git_handler.py a bit though.

This function is pretty fast: on a Linux machine with a warm cache, verifying a
repository with around 50,000 files takes just 20 seconds. There is scope for
further improvement through parallelization, but conducting tree walks in
parallel is non-trivial with the current worker infrastructure in Mercurial.
2014-02-26 14:19:24 -08:00
Siddharth Agarwal
56cbe49bb0 git_handler: remove init_if_missing
This function is a no-op and can be removed.
2014-02-25 20:01:42 -08:00
Siddharth Agarwal
6d1bd2e02e git_handler: make self.git a lazily evaluated property
This allows other functions to be able to use the `git` property without
needing to care about initializing it.

An upcoming patch will remove the `init_if_missing` function.
2014-02-25 19:51:02 -08:00
Siddharth Agarwal
bbfc3bf8b0 overlayrevlog: handle root commits correctly
Previously, we'd try to access commit.parents[0] and fail. Now, check for
commit.parents being empty and return what Mercurial thinks is a repository
root in that case.
2014-02-25 00:23:12 -08:00
Siddharth Agarwal
a5e956514d overlayrevlog: handle rev = 0 correctly
Previously we'd just test if gitrev was falsy, which it is if the rev returned
is 0, even though it shouldn't be. With this patch, test against None
explicitly.

This unmasks another bug: see next patch for a fix and a test.
2014-02-25 00:20:22 -08:00
Siddharth Agarwal
fea85d57c6 git_handler: fix call to self.ui.progress in flush
Since we now directly use progress on self.ui, we shouldn't pass in self.ui as
the first argument. Oops.
2014-02-24 15:29:31 -08:00
Siddharth Agarwal
2cc81f4c1f git_handler: don't compute tags for each tag imported
Previously we'd recompute the repo tags each time we'd consider importing a Git
tag. This is O(n^2) in the number of tags and produced noticeable slowdowns in
repos with large numbers of tags.

To fix this, compute the tags just once. This is correct because the only case
where we'd have issues is if multiple new Git tags with the same name were
introduced, which can't happen because Git tags cannot share names.

For a repository with over 200 tags, this causes a no-op hg pull to be sped up
by around 0.5 seconds.
2014-02-24 11:38:00 -08:00
Siddharth Agarwal
27784bf3bc util: drop support for Mercurial < 1.4 2014-02-19 18:49:42 -08:00
Siddharth Agarwal
01fb9068a0 git_handler: replace util.progress with ui.progress
util.progress was a shim for Mercurial < 1.4.
2014-02-19 18:49:28 -08:00
Siddharth Agarwal
01896282f6 overlay: drop support for Mercurial < 1.9 2014-02-19 18:46:56 -08:00
Siddharth Agarwal
a49ac12684 git_handler: remove old and bogus code for deleting entries from tags cache
This code never worked for Mercurial >= 2.0, since it neither had repo._tags
nor repo.tagscache.
2014-02-19 18:45:36 -08:00
Siddharth Agarwal
d7bad71d02 git_handler.save_tags: drop support for Mercurial < 1.9 2014-02-19 16:12:27 -08:00
Siddharth Agarwal
5ef555a629 git_handler.save_map: drop support for Mercurial < 1.9 2014-02-19 16:10:35 -08:00
Siddharth Agarwal
8f2d697a54 hgrepo.tags: drop support for Mercurial < 2.0
A new property called _tagscache was introduced in Mercurial 2.0, so the cache
wasn't actually working.

The contract for tags() also changed at some point -- it stopped returning
nodes that weren't in the repo. This will need to be accounted for if we
start using the tags cache again. However, it isn't very clear whether the
Mercurial tags cache is actually worth doing, since we already have a
separate in-memory cache for Git tags in the handler.
2014-02-19 16:09:23 -08:00
Siddharth Agarwal
41357ce554 hgrepo.push: drop support for Mercurial < 1.6 2014-02-19 15:55:45 -08:00
Siddharth Agarwal
732da34592 gitrepo: drop support for Mercurial < 1.7 2014-02-19 15:54:37 -08:00
Siddharth Agarwal
7e329463b5 getremotechanges: drop support for Mercurial < 1.7 2014-02-19 15:54:04 -08:00
Siddharth Agarwal
a1a2eb9b35 nodetags: drop support for Mercurial < 1.6 2014-02-19 15:53:14 -08:00
Siddharth Agarwal
c11b48a4e7 extsetup: drop support for Mercurial < 1.7 2014-02-19 15:52:14 -08:00
Siddharth Agarwal
6a0d42bac0 version: drop support for Mercurial 1.9.3
Upcoming patches will clean up some code that makes hg-git work with Mercurial
versions < 2.0.
2014-02-19 15:48:27 -08:00
Siddharth Agarwal
6b4e5f67db hg2git: fix subrepo handling to be deterministic
Previously, the correctness of _handle_subrepos was based on the order the
files were processed in. For example, consider the case where a subrepo at
location 'loc' is replaced with a file at 'loc', while another subrepo exists.
This would cause .hgsubstate and .hgsub to be modified and the file added.

If .hgsubstate was seen _before_ 'loc' in the modified/added loop, then
_handle_subrepos would run and remove 'loc' correctly, before 'loc' was added
back later. If, however, .hgsubstate was seen _after_ 'loc', then
_handle_subrepos would run after 'loc' was added and would remove 'loc'.

With this patch, _handle_subrepos merely computes the changes that need to be
applied. The changes are then applied, making sure removed files and subrepos
are processed before added ones.

This was detected by setting a random PYTHONHASHSEED (in this case, 3910358828)
and running the test suite against it. An upcoming patch will randomize the
PYTHONHASHSEED in run-tests.py, just like is done in Mercurial.
2014-02-19 20:52:59 -08:00
Siddharth Agarwal
689b38dc44 hg2git: move parse_subrepos to top level
durin42 expressed a desire for this function to be at the top level.
2014-02-19 20:18:43 -08:00
Siddharth Agarwal
08f028a3c9 gitnodekw: use githandler from repo
Since a fresh GitHandler is no longer created for every commit, this speeds up
the {gitnode} template massively.

For a repo with over 50,000 commits, the command

hg log -l 10 --template '{gitnode}\n'

speeds up from 2.4 seconds to 0.3.
2014-02-19 15:23:36 -08:00
Siddharth Agarwal
e7c06facc2 revset_gitnode: use githandler from repo 2014-02-19 15:22:54 -08:00
Siddharth Agarwal
1d58a0a197 revset_fromgit: use githandler from repo 2014-02-19 15:22:36 -08:00
Siddharth Agarwal
b1bbd30c48 getremotechanges: use githandler from repo 2014-02-19 15:15:01 -08:00
Siddharth Agarwal
886532ea23 findcommonoutgoing: use githandler from repo 2014-02-19 15:13:43 -08:00
Siddharth Agarwal
068acd034c gclear: use githandler from repo 2014-02-19 15:12:59 -08:00
Siddharth Agarwal
fcd7e472fc gexport: use githandler from repo 2014-02-19 15:12:42 -08:00
Siddharth Agarwal
298b98a518 gimport: use githandler from repo 2014-02-19 15:12:20 -08:00
Siddharth Agarwal
dd8bbcebed gitrepo: drop unused _initializehandler function and handler property
Also drop the GitHandler import. All this now lives on hgrepo.
2014-02-19 15:11:14 -08:00
Siddharth Agarwal
d239f557d1 gitrepo.listkeys: use githandler from localrepo
Previously we'd load the git and hg maps twice on separate git handler objects.
This avoids that.

For a repo with over 50,000 commits, this brings a no-op hg pull down from 2.45
seconds to 2.37.
2014-02-19 15:07:19 -08:00
Siddharth Agarwal
772133c48a hgrepo.tags: use githandler property
Currently we call hgrepo.tags() separately for each tag. (This should be fixed
at some point.) This avoids initializing a separate git handler for each tag.

For a repository with over 150 tags, this brings down a no-op hg pull by 0.05
seconds.
2014-02-19 14:16:40 -08:00
Siddharth Agarwal
232c6612ae hgrepo._findtags: use githandler property 2014-02-19 14:15:33 -08:00
Siddharth Agarwal
1c6dc044d5 hgrepo.findoutgoing: use githandler property 2014-02-19 14:14:54 -08:00
Siddharth Agarwal
f87f28dc3a hgrepo.push: use githandler property 2014-02-19 14:14:01 -08:00
Siddharth Agarwal
63f40c5059 hgrepo.pull: use githandler property 2014-02-19 14:12:38 -08:00
Siddharth Agarwal
728f8df8de hgrepo: expose git handler as a property
This and upcoming patches have the goal of initializing a GitHandler just once
for a Mercurial repo.
2014-02-19 14:12:03 -08:00
Siddharth Agarwal
7d37b2a516 git_handler: terminate new commit DAG traversal at known commits
Any commit in _map_git is already known, so there's no point walking further
down the DAG.

For a repo with over 50,000 commits, this brings down a no-op hg pull from 38
seconds to 2.5.
2014-02-18 20:30:27 -08:00
Siddharth Agarwal
6f79df86d2 git_handler: use convert_list to cache git objects
getnewgitcommits() does a weird traversal where a particular commit SHA is
visited as many times as the number of parents it has, effectively doubling
object reads in the standard case with one parent. This patch makes the
convert_list a cache for objects, so that a particular Git object is read just
once.

On a mostly linear repository with over 50,000 commits, this brings a no-op hg
pull down from 70 seconds to 38, which is close to half the time, as expected.
Note that even a no-op hg pull currently does a full DAG traversal -- an
upcoming patch will fix this.
2014-02-18 20:22:13 -08:00
Siddharth Agarwal
36052aca77 git_handler: note that new commits are returned in topo order
This wasn't obvious to me at first.
2014-02-18 20:13:15 -08:00
Siddharth Agarwal
5e72b26e7b git_handler: fix progress reset call 2014-02-16 01:13:10 -08:00
Siddharth Agarwal
298fec2a4b git_handler: use repo.changelog.node instead of repo.lookup
For a repo with over 50,000 commits, this brings down the computation of
'export' from 1.25 seconds to 0.25 seconds.

To scale this to hundreds of thousands of commits, one solution might be to
maintain the mapping in a DAG data structure mirroring the changelog, over
which findcommonmissing can be used.
2014-02-16 01:11:47 -08:00
Siddharth Agarwal
d7dbce79bd hg2git: call _handle_subrepos when .hgsubstate is removed
Now that _handle_subrepos can handle .hgsubstate being removed, we should use
it for that.

The test changes make sure that the SHAs roundtrip.
2014-02-12 22:55:16 -08:00
Siddharth Agarwal
39d1c15298 hg2git: make _handle_subrepos worked in the removed case
A test for this will be included in an upcoming patch.
2014-02-12 21:19:04 -08:00
Siddharth Agarwal
ca74d6d967 hg2git: add 'new' prefix to _handle_subrepos variables
An upcoming patch will introduce similar variables for self._ctx. This helps
disambiguate.
2014-02-12 20:34:09 -08:00
Siddharth Agarwal
3cadf19b94 hg2git: factor out subrepo parsing into a separate function
This code will be used in multiple contexts in an upcoming patch.
2014-02-12 20:28:28 -08:00
Siddharth Agarwal
44c13be822 hg2git: factor out remove path logic into a separate function
This will be used by _handle_subrepos in an upcoming patch.
2014-02-12 19:50:56 -08:00
Siddharth Agarwal
94957f9a66 git_handler: remove collect_gitlinks now that it is unused 2014-02-15 16:21:49 -08:00
Siddharth Agarwal
8d0c4fe9f2 git_handler: fix hgsubstate generation
Before this patch, in the git to hg conversion, .hgsubstate once created is
never deleted, even if no submodules are any longer present. This is broken
state, as shown by the test for which the SHA changes. Fix that by looking at
the diff instead of just what submodules are present.

Since 'gitlinks' now contains *changed* gitlinks, not *all* gitlinks, it no
longer makes sense to gate gitmodules checks on that.

This patch simply demonstrates that the test was broken; an upcoming patch will
introduce more tests.

Bonus: this also makes the import process faster because we no longer need to
walk the entire tree to collect gitlinks.

This will cause the SHAs of repos that have submodules added and then removed
to change.
2014-02-14 15:44:50 -08:00
Siddharth Agarwal
94f67b719d git_handler: move check for gparents in repo to start of import_git_commit
Also drop Mercurial < 1.5 support.
2014-02-14 16:16:25 -08:00
Siddharth Agarwal
82b4618e1f git_handler: move gparents initialization up to start of import_git_commit
gparents will be used to compute .hgsubstate in an upcoming patch.
2014-02-14 13:15:45 -08:00
Siddharth Agarwal
35411ae613 git_handler: return gitlinks in get_files_changed
Currently, to figure out which gitlinks are in a repository we walk through the
entire tree. This patch lets us use get_files_changed to detect which gitlinks
have changed.
2014-02-14 11:31:54 -08:00
Siddharth Agarwal
873a402c5e hg2git: call status on newctx, not newctx.rev()
There's no benefit to calling rev().
2014-02-12 18:05:12 -08:00
Siddharth Agarwal
17657a025c hg2git: store ctx instead of rev
Storing a ctx enables values like manifests to be cached on the context.
2014-02-12 17:49:14 -08:00
Siddharth Agarwal
b470bfcf51 hg2git: rename ctx to newctx in update_changeset
An upcoming patch will introduce a new field called _ctx. This helps prevent
confusion.
2014-02-12 17:47:38 -08:00
Dov Feldstern
97838c2daf fallback to unauthenticated http(s) access when using older dulwich 2014-02-13 02:00:18 +02:00
Dov Feldstern
7e0c3b141b support for http(s) basic authentication
This is an adaptation of the original patch submitted in [1], without the
monkey-patching: a patch has been committed in dulwich [2] which allows clients
to supply a custom urllib2 "opener" for opening the url; here, we provide such
an opener, which provides authentication information obtained from the hg
config.

[1] https://groups.google.com/forum/#!topic/hg-git/9clPr1wdtiw
[2] https://bugs.launchpad.net/dulwich/+bug/909037
2014-02-13 01:37:22 +02:00
Siddharth Agarwal
a06bbdeeac git_handler: don't bail on multiple octopus merges in succession
Consider two octopus merges, one of which is a child of the other. Without this
patch, get_git_parents() called on the second octopus merge checks that each p1
is neither in the middle of an octopus merge nor the end of it. Since the end
of the first octopus merge is a p1 of the second one, this asserts.

Change the sanity check to only make sure that p1 is not in the middle of an
octopus merge.
2014-02-11 22:13:34 -08:00
Jordi Gutiérrez Hermoso
f4e623cf8f gitdirstate: import errno for handling OSError
When handling OSError while visiting subdirectories, we're checking
errno, but we never imported this module. This small patch fixes this.
2014-02-07 10:43:49 -05:00
anatoly techtonik
a09eed97b0 git_handler.py: less cryptic error message when push fails 2013-12-15 15:19:22 -05:00
Augie Fackler
1dfa836781 testedwith: drop 2.3.1, which has at least one test failure 2013-12-14 11:59:39 -05:00
Augie Fackler
e94e063d88 testedwith: add 2.8.1 2013-12-14 11:19:39 -05:00
Augie Fackler
7dc6835322 gitignore: gate feature on dirstate having rootcache and ignore having readpats 2013-12-14 11:19:25 -05:00
Augie Fackler
6d7d1ac665 git_handler: iterate over new refs in sorted order to stabilize test output
An earlier patch already fixes the test expectations (oops), so this
just makes sure the tests always pass.
2013-12-13 13:02:08 -05:00
Augie Fackler
58fd252e1f overlay: add kludge to make sure we only ever give hexshas to dulwich 2013-12-13 12:54:39 -05:00
Jordi Gutiérrez Hermoso
adf3575aa8 git-handler: turn refs from None to {} so that empty git repos can convert 2013-12-03 16:55:17 -05:00
Ben Kehoe
6f094a5bfe Fix for #68 | Use .gitignore files (with proper semantics) 2013-11-27 09:27:59 -05:00
Augie Fackler
29a7a3aee8 overlays: fix incoming support for hg 2.8
This was crafted mostly via a bunch of aimless flailing in the
code. I'm pretty well convinced at this point that the incoming
support needs to be rewritten slightly to behave properly in the new
world order (specifically, the overlayrepo class probably should be
subclassing localrepo, or else more directly reimplementing things
instead of trying to forward methods.)
2013-10-05 17:40:50 -04:00
Augie Fackler
6f0e54cb16 Merge a work-around for a bug in dulwich.
I've been waiting for dulwich upstream to fix this *and* for a test
from domruf that's acceptable. Having gotten neither over a period of
/months/, and having hit the bug myself, I'm moving on and accepting a
patch without tests. This will likely break again, but hopefully
before we'd break it dulwich will be fixed.
2013-09-17 09:59:36 -04:00
Augie Fackler
df2fed070b git_handler: fix bugs introduced by 93aaff49e601 which could never have passed tests 2013-09-17 09:58:36 -04:00
Augie Fackler
3460706765 git_handler: clean up trailing whitespace 2013-09-17 09:58:12 -04:00
Alex Regueiro
a5c98b616b Upgraded to use latest version of dulwich (0.9.1). 2013-09-13 01:42:27 +01:00
Augie Fackler
ff1e9014cf merge 2013-08-28 13:49:01 -04:00
nsuke
291493c743 git_handler: skip exporting hg tags whose names are not valid as git tag name 2013-08-12 23:20:41 +09:00
Risto Kankkunen
e3f5583d09 Make the path part of URL contain a leading slash only if it's not followed by tilde. (issue #71) 2013-07-11 00:22:07 +03:00
André Felipe Dias
071243136a Fixes #54 | option branch_bookmark_suffix doesn't move bookmarks along
Test case based on the one proposed by David Carr at
https://bitbucket.org/durin42/hg-git/issue/54/with-option-branch_bookmark_suffix-set
2013-07-01 16:04:53 -03:00
Gregory Szorc
10dcc5b5c0 Only export modified Git trees
Previously, we emitted every Git tree when updating between Mercurial
changesets. With this patch, we now only emit Git trees that changed. A
side-effect of the implementation is that we now only update in-memory
Git trees objects that changed. Before, we always touched Git trees,
invalidating them in the process and causing Dulwich to recalculate
their SHA-1. Profiling revealed this to be expensive and removing the
extra calculation shows a nice performance win.

Another optimization is to not sort the order that changed paths are
processed in. Previously, we sorted by length, longest to shortest.
Profiling revealed that the sorts took a non-trivial amount of time.
While sorted execution resulted in likely idempotent behavior, it
shouldn't be strictly required.

On the author's machine, conversion of the Mercurial repository itself
decreased from ~493s to ~333s. Even more impressive is conversion of
Firefox's main repository (which is considerably larger). Converting the
first 200 revisions of that repository decreased from ~152s to ~42s.
2013-04-14 11:11:41 -07:00
Augie Fackler
66478492e0 overlaymanifest: add iteritems(), used by recent hg versions 2013-04-03 14:37:13 -05:00
Gregory Szorc
baa19027ef Export Git objects from incremental Mercurial changes
This replaces the brute force Mercurial to Git export with one that is
incremental. It results in a decent performance win and paves the road
for parallel export via using multiple incremental exporters.
2013-03-19 22:44:01 -07:00
Hal Wine
e83de5b7dc scrub bad timezone values before dulwich sees them
If dulwich is presented with a "sub minute" timezone offset, it throws
an exception (see tests/test-timezone.t). This patch rounds the timezone
down to the next minute before passing the value to dulwich.
2013-02-05 08:25:37 -08:00
David M. Carr
114a8500cb push: provide better output about changed references (issue #64)
As pointed out by l33t, Hg-Git's output for push doesn't currently do a very
good job of telling the user what happened.  My previous changes in this area
had moved some of the output from status to note, making it only show if
--verbose was specified.  However, I hadn't realized at the time that the
reference information (though overly verbose) was providing a valueable purpose
that otherwise wasn't met; telling the user that a remote reference had changed.

This changeset makes it so that:
*   default output will include simple messages like "adding reference
    refs/heads/feature" and "updating reference refs/heads/master" (omitting any
    mention of unchanged references)
*   verbose output will include more detailed messages like "adding reference
    default::refs/heads/feature => GIT:aba43c" and "updating reference
    default::refs/heads/master => GIT:aba43c" (omitting any mention of unchanged
    references)
*   debug output will include the detailed output like in verbose, but
    addtionally will include messages like "unchanged reference
    default::refs/heads/other => GIT:aba43c"

https://bitbucket.org/durin42/hg-git/issue/64/push-confirmation
2013-01-06 02:31:37 -05:00
David M. Carr
a6e63bd878 push: add more output about what was added (issue #64)
l33t pointed out that currently, Hg-Git doesn't provide any confirmation that a
push was successful other than the exit code.  Normal Mercurial provides a
couple other messages followed by "added X changesets with Y changes to
Z files".  After this change, Hg-Git will provide much more similar output.
It's not identical, as the underlying model is substantially different, but the
concept is the same.  The main message is "added X commits with Y trees and
Z blobs".

This change doesn't affect the output of what references/branches were touched.
That will be addressed in a subsequent commit.

Dulwich doesn't provide an easy hook to get the information needed for this
output.  Instead of passing generate_pack_contents as the pack generator
function to send_pack, I pass a custom function that determines the "missing"
objects, stores the counts, and then calls generate_pack_contents (which then
will determine the "missing" objects again.

The new expected output:
searching for changes # unless quiet true
<N> commits found     # if verbose true
list of commits:      # if debugflag true and at least one commit found
<each hash>           # if debugflag true and at least one commit found
adding objects        # if at least one commit found unless quiet true
added <N> commits with <N> trees and <N> blobs # if at least one object unless
                                               # quiet true

https://bitbucket.org/durin42/hg-git/issue/64/push-confirmation
2013-01-06 01:46:57 -05:00
domruf
5d467e12d1 fix/work around https://bugs.launchpad.net/dulwich/+bug/1025886 2012-12-11 15:44:23 +01:00
Augie Fackler
5c9bcd81f4 Merge with master. 2012-11-23 20:20:48 -06:00
David M. Carr
4ad1b4bfde git_handler: add bookmark compatibility with new bmstore (issue #60)
Prior to this fix, tests against the latest hg codebase would fail with:
creating bookmarks failed, do you have bookmarks enabled?
2012-11-22 18:44:09 -05:00
Augie Fackler
3f40fa1ef5 Merge 2012-11-11 17:12:55 -06:00
Augie Fackler
2e95d380da git_handler: defend against unexported revisions in tag exporting 2012-11-11 15:46:19 -06:00
Augie Fackler
76a939ac4f Merge obsolete marker fix. 2012-10-29 21:34:37 -05:00
David M. Carr
ceacd986b2 overlaychangectx: fix compatibility with mercurial 2.4-rc (no attribute _repo)
This isn't a real implementation of phases support.  Rather, it's just enough
to avoid the traceback.

Traceback (most recent call last):
  File "/usr/local/share/python/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 65, in dispatch
    return _runcatch(req)
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 88, in _runcatch
    return _dispatch(req)
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 741, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 514, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 831, in _runcommand
    return checkargs()
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 802, in checkargs
    return cmdfunc()
  File "/usr/local/lib/python2.7/site-packages/mercurial/dispatch.py", line 738, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/local/lib/python2.7/site-packages/mercurial/util.py", line 472, in check
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/mercurial/commands.py", line 3942, in incoming
    return hg.incoming(ui, repo, source, opts)
  File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 525, in incoming
    return _incoming(display, subreporecurse, ui, repo, source, opts)
  File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 494, in _incoming
    displaychlist(other, chlist, displayer)
  File "/usr/local/lib/python2.7/site-packages/mercurial/hg.py", line 524, in display
    displayer.show(other[n])
  File "/usr/local/lib/python2.7/site-packages/mercurial/cmdutil.py", line 670, in show
    self._show(ctx, copies, matchfn, props)
  File "/usr/local/lib/python2.7/site-packages/mercurial/cmdutil.py", line 691, in _show
    label='log.changeset changeset.%s' % ctx.phasestr())
  File "/usr/local/lib/python2.7/site-packages/mercurial/context.py", line 203, in phasestr
    return phases.phasenames[self.phase()]
  File "/usr/local/lib/python2.7/site-packages/mercurial/context.py", line 201, in phase
    return self._repo._phasecache.phase(self._repo, self._rev)
AttributeError: 'overlaychangectx' object has no attribute '_repo'
2012-10-29 20:16:00 -04:00
David M. Carr
54da2c48f3 listkeys: simplify ref stripping expression
Eliminate a find that would always return 0, based on an example in git_handler
update_hg_bookmarks.
2012-10-28 20:32:42 -04:00
David M. Carr
ee0a3edb54 pull: don't pull tags as bookmarks
This should fix a bug introduced by 4f4ab2d which caused all tags to be
duplicated as bookmarks on pull.

Test coverage has been added for pull to allow verifying the fix.
2012-10-26 22:46:02 -04:00
Augie Fackler
586391e789 Merge 2012-10-25 23:22:36 -05:00
David M. Carr
deba26ad93 push: suppress "exporting hg objects to git" message
When communicating with the user on push/outgoing, Mercurial doesn't show a
"exporting hg objects to git" message, so we shouldn't.  The message has been
changed to be shown if --verbose is specified.
2012-10-25 21:47:44 -04:00
David M. Carr
fb74ae0f84 push: suppress ref output by default
When communicating with the user on push, Mercurial doesn't show much on
success.  Currently, Hg-Git shows every changed ref.  After this change,
the default output will more closely match Mercurial's regular behavior (no
per-ref output), while changed refs will be shown if --verbose is specified,
and all refs will be shown if --debug is specified.
2012-10-25 21:47:36 -04:00
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
7cbc08a5a2 peer: pass localrepo to new gitrepo instances
This change wraps hg.peer to allow for capturing the repo object.  It is then
passed in to new gitrepo instanceds.  This will be needed to implement later
functionality, such as richer bookmark support using pushkeys.
2012-10-25 19:54:05 -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
Jordi Gutiérrez Hermoso
8ab8c36d60 git_handler: replace with-statement with try-finally
Python 2.4 does not have a with-statement
2012-10-18 12:25:04 -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
cf59f5739c docs: include testedwith
Mercurial has support for including information about the tested versions of
Mercurial for an extension when it detects that an extension has broken.  This
change includes the appropriate attribute in the extension.
2012-09-27 22:52:54 -04:00
David M. Carr
37995f7c6c docs: include buglink
Mercurial has support for including a link to an issue tracker when it detects
that an extension has broken.  This change includes the appropriate attribute
in the extension, pointing it at the issue tracker for the main BitBucket repo.
2012-09-27 22:42:41 -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
e7b625ba6a docs: update to correctly reflect that local git repositories are supported 2012-09-13 20:57:37 -04: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
David M. Carr
20a3702adc revsets: add fromgit and gitnode selectors
Support for Hg 1.5.4 was removed, as it doesn't support revsets and is older
than the earliest version we want to put special effort into supporting.
2012-08-22 23:39:45 -04:00
David M. Carr
11cde56154 templatekw: add support for gitnode template keyword 2012-08-22 23:39:45 -04:00
David M. Carr
9e4da6cfb3 help: add additional help topics 2012-08-22 23:39:45 -04: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
Augie Fackler
15e2601c3a overlaymanifest: add the withflags method introduced in hg change 3f7abfd06d2d 2012-07-26 18:59:19 -05:00
Augie Fackler
e49137e34a girepo: add _capabilities method expected after the peer refactor 2012-07-26 18:58:18 -05:00
Toshi MARUYAMA
2833d729d3 hgrepo: fix _findtags changes on Mercurial 2.2 2012-07-08 16:10:23 +09:00
Artem Tikhomirov
274ecce47c repository in mercurial.repo.py starts with lowercase 2012-07-26 19:01:17 +02:00
Augie Fackler
13504b1f1e gitrepo: correct capitalization of peerrepository 2012-07-19 19:36:57 -05:00
Bryan O'Sullivan
d0a3db710b gitrepo: cope with module/class renames in hg 2.3 2012-07-18 13:16:43 -07: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
27851f0e49 gitrepo: add url() attribute to fix subrepo support 2012-05-12 03:33:19 -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
7659e2b8a6 outgoing: abort on broken hg versions rather than printing wrong results 2011-09-09 16:08:31 -05:00
Augie Fackler
2a4f0d3a5b Adapt to atomictempfile API changes from Mercurial. 2011-09-09 16:00:52 -05:00
Augie Fackler
9b926199fe Merge test fixes for dulwich changes and output changes. 2011-09-09 15:44:25 -05:00
Augie Fackler
b8794ce003 Merge incoming fix. 2011-09-09 15:43:35 -05:00
Augie Fackler
9e574c9364 getremotechanges: fix incoming support
'hg incoming' causes getremotechanges to be called with revs as a
positional argument, which we were not correctly catching here.
2011-09-09 15:42:24 -05:00
Augie Fackler
bad8d98927 overlay: stop using deprecated tree.entries() method 2011-09-09 13:44:58 -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
Brendan Cully
d499a8fc67 Unbreak outgoing to non-git repos with hg pre-1.9
The wrapped version of findoutgoing unconditionally mangled the
keyword arguments, but doesn't do version fixups unless the
remote is a git repository. This change only mangles the argument
list when the remote is a git repository.
2011-06-23 11:29:30 -07:00
Augie Fackler
890facca02 test fixes for progress cleanup 2011-06-17 15:01:31 -05:00
Brendan Cully
d387fe4170 Fix mercurial issue2855
I accidentally broke transplant by making revs a required argument.
2011-06-17 09:23:52 -07: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
b7ea69294f Prevent exception in incoming with hg <= 1.6
With this patch, incoming against a git repo returns "no changes found"
with hg <= 1.6.
2011-05-31 10:46:52 -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
Augie Fackler
b0b767dbbe Merge. 2011-05-23 19:32:26 -05:00
César Izurieta
58c48d9319 Use author as email when it is an email 2011-05-23 19:29:33 -03:00
Brendan Cully
59f1915416 Define gitrepo.islocal
This makes hg clone src dst create the correct default path when
src is a local path.
2011-05-23 10:32:38 -07:00
Adrian Sampson
4fa25100ed respect references to tags that differ between git and .hgtags 2011-05-20 22:41:43 -07:00
Adrian Sampson
8c05238aa7 use new names for tags cache attributes if they're available 2011-05-20 22:36:06 -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
Brendan Cully
e6be1640a8 Message cleanups
Only show importing/exporting messages when there is something
to do. Change "importing Hg objects into Git" to "exporting
hg objects to git" (and lowercase the other direction).
2011-05-18 00:31:36 -07:00
Brendan Cully
b7699cab00 Improve error reporting in get_refs
With this patch, attempts to push (or run outgoing) to read-only git URLs
at github return github's helpful error message instead of just saying
the remote end hung up.
2011-05-17 16:26:13 -07:00
Augie Fackler
74b9553cd5 Cope with new discovery code without crashing. 2011-05-15 12:26:24 -05:00
Augie Fackler
e7abdc3a9a url wasn't ever published as url.url, and is now util.url 2011-05-15 12:26:03 -05:00
Augie Fackler
b2953e0941 git_handler: support versions of hg without bookmarks 2011-05-15 12:24:25 -05:00
Adrian Sampson
ea2c812385 fix for "outgoing" (previously, always printed all revisions) 2011-05-10 21:39:17 -07:00
Adrian Sampson
e833363641 activate a tipmost bookmark (git branch) after clone 2011-05-10 21:13:18 -07:00
Mads Kiilerich
be6c59edbe compatibility with new url handling in Mercurial 1.9 2011-04-05 13:31:28 +02:00
Augie Fackler
e0d8a4f3f9 Merge spaces in tags fix. 2011-03-23 21:31:26 -05:00
DontCare4Free
9ac9903dfb Indenting fix 2011-03-24 00:26:32 +01:00
DontCare4Free
f9dd37eac6 Made hggit.git_handler.get_changed_refs try to use commands.bookmark before trying with bookmarks.bookmark, for compatibility with Mercurial 1.8+. 2011-03-24 00:13:59 +01:00
Dmitry Gladkov
dc604a8d5b fix handling of spaces in hg tag names 2011-03-23 02:43:32 +02:00
Augie Fackler
d4ab466278 git_handler: update ctx label handling for bookmarks in core 2011-03-01 08:23:09 -06:00
Kevin Bullock
2de8317548 support upcoming Mercurial 1.8 2011-02-24 16:51:40 -06:00
timeless
e0e5ff5a22 progress: use gerund form for import 2011-02-22 14:58:35 +01:00
Alexey Sokolov
f07d1aba51 Fix "hg outgoing" for mercurial versions which look like 1.6.x
Previous commit (hg-c1876c8a2531) assumed that there's nothing between
1.6 and 1.7
But 1.6.3 is more than 1.6, while still less than 1.7
2011-02-15 13:35:03 +06:00
jsumners
162fcb35fb I found that inspect.getargspec(discovery.findoutgoing)[0] was returning [] instead of the expected function definition.
Since the change occurred between Mercurial 1.6 and 1.7, a simple version check works instead.
This fixes https://github.com/schacon/hg-git/issues/issue/168
2011-02-09 10:21:36 -05:00
Mads Kiilerich
f05e529556 Create ssh subprocess with a shell command instead of an exec list
This allows ui.ssh to be configured with a command line fragment instead of
just the name of an executable.
2010-12-25 23:49:16 +01:00
Tay Ray Chuan
b96ab4cee9 pass hg's ui.ssh config to dulwich
This allows Windows users to override dulwich's default (the unix-y
ssh).
2010-12-22 16:57:26 -06:00
Augie Fackler
83cbd0b18e Fix bug where remote ref map wrote out binary nodes. 2010-12-20 23:30:16 -06:00
Augie Fackler
6e81a1af77 hgrepo: completely rework handing of remote refs marking
Previously, we appended to .hg/localtags on every pull. This meant
that we never deleted refs that disappeared on the remote server, and
the file length grew without bound. Now we use our own file
(.hg/git-remote-refs) and we do prune refs that disappear from the
remote server.
2010-12-20 22:37:07 -06:00
Augie Fackler
006aedf259 demandimport: defend against collections breakage in new dulwich 2010-10-29 08:31:42 -05:00
Mike Blume
b4ec782ca1 fix typo -- my bad >.< 2010-10-24 14:19:39 -07:00
Mike Blume
266b9b4429 Looks like the latest version of Dulwich returns a tuple here. Let's handle that 2010-10-24 14:00:32 -07:00
Augie Fackler
c13e8ed89d tests: import test-push-r (with slight changes) from Mercurial
This lets us detect defects in our wrappers which would break
Mercurial when working against normal hg repositories with hg-git
enabled.
2010-08-15 09:45:00 -05:00
Augie Fackler
fe874e7b7f findoutgoing: update wrapper for hg change d844bc669660 2010-07-30 17:24:28 -05:00
Augie Fackler
e2638245c2 gitrepo: update for pushable bookmarks 2010-07-05 11:54:06 -05:00
Augie Fackler
d421c65e08 hgrepo: pass through newbranch arg if pushing to hg 2010-06-18 08:20:47 -05:00
Augie Fackler
bbfe593b68 Add just enough code to handle changes to cset discovery. 2010-06-12 21:49:14 -05:00
Augie Fackler
185de4bf07 Merge documentation of in-tree and cleanup of the variable. 2010-06-12 21:23:01 -05:00
Tay Ray Chuan
75b937c19c enforce stricter matching for pull -r
Use an exact match with the ref name ('foo' in 'refs/heads/foo'),
instead of just checking if it ended with '/foo'.

This allows

  $ hg pull -r foo

to run successfully on a repo containing the branches

 - 'foo',
 - 'mine/foo',
 - 'theirs/foo'
2010-06-02 20:14:26 +08:00
Augie Fackler
28545e94bc Merge fix from Benoit Allard 2010-06-12 21:19:40 -05:00
Augie Fackler
5518aa1a5a Cope with tags being sorted (hg cset 0376c4f17df5) by backporting that behavior 2010-06-12 21:14:33 -05:00
Augie Fackler
b6ff51f6c0 push: handle argspec change from a00aac92bfb9 2010-06-12 21:12:21 -05:00
Benoit Allard
a808ff61ec Fix a traceback when accessing _get_object() on Tag 2010-05-20 00:16:59 +02:00
Tay Ray Chuan
4b2fb41612 explicitly expect boolean values for git.intree 2010-05-17 20:04:02 +08:00
Augie Fackler
c9fb39537b Un-break hg 1.3 by adding a compat layer for progress. 2010-04-30 10:35:13 -05:00
Augie Fackler
a6ef0b0441 Merge style fix 2010-04-05 19:06:48 -05:00
Augie Fackler
5919da5815 git_handler: prefer () continuation to \ continuation. 2010-04-05 19:06:20 -05:00
Tay Ray Chuan
fff9a81fa3 Merge branch 'rc/push-tag' into rc/master 2010-04-04 23:26:46 +08:00
Tay Ray Chuan
58dec6d0a4 when pushing, check if server is advertising annotated tags
Check if already we have these annotated tags; if so, don't push it.

Update test-git-tags too.
2010-04-04 23:16:00 +08:00
Tay Ray Chuan
e09d350f36 Merge branch 'rc/fix-ann-tags' into rc/master 2010-04-04 19:23:34 +08:00
Tay Ray Chuan
8bce9096c1 update references to Tag.get_object()
dulwich recently renamed [1] the Tag.get_object() method to
_get_object(). Update our usage correspondingly.

[1] git reference: f85ce56 (Support determining blob id without joining
all chunks first.)
2010-04-02 20:08:14 +08:00
Tay Ray Chuan
5fae58d6aa handle apply_delta() return value correctly
dulwich recently changed apply_delta() [1] to return lists. Invoke
join() on the output with an empty string, as dulwich does in its
codebase.

[1] git reference: a2709f6 (Return chunks from apply_delta.)
2010-04-02 19:56:50 +08:00
Tay Ray Chuan
dbadcb184b update_remote_branches: don't store de-refed tags
If a git tag is of the annotated-type, the git server sends an
additional line with the SHA-1 the tag dereferences to (eg.
refs/tag/mytag^{}). These aren't "real" tags, so don't store them.
2010-03-29 13:19:52 +08:00
Tay Ray Chuan
336ec5a893 update_remote_branches: refactor head usage
Splice the ref name only once, and don't loop through refs/heads
multiple times.

This changes the order in which hg tags are created; update test output
to reflect this.
2010-03-29 13:19:00 +08:00
Tay Ray Chuan
41495ccdb6 update_remote_branches: don't prepend '/' to heads
We were saving tracking branches to 'refs/remotes/<remote>//<ref>'
(double slash).
2010-03-29 13:00:49 +08:00
Augie Fackler
a18abe29e6 Merge debug message fix. 2010-03-27 22:20:18 -05:00
Augie Fackler
d1961293e0 Various hg 1.4 compat fixes. 2010-03-27 21:37:58 -05:00
Augie Fackler
4e59f313a6 pull: make it possible to un-wedge the repo after stripping git revs
This adds a new command, which is inelegant, but it lets you safely
pick up pulling fairly quickly.
2010-03-25 20:24:00 -05:00
Augie Fackler
65560ee872 hggit: defend against exceptions when pulling with -r 2010-03-25 20:23:00 -05:00
Augie Fackler
c3fa923231 hggit: don't wrap gitrepo with hgrepo 2010-03-25 20:23:00 -05:00
Augie Fackler
bf0efb8a3e git_handler: 80 columns cleanup 2010-03-25 19:39:00 -05:00
Augie Fackler
c5bfabbe71 git_handler: fix % formatting in ref errors. 2010-03-25 19:37:00 -05:00
Tay Ray Chuan
23362335d5 export_hg_commit: fix debug note
We were outputting the raw SHA-1.
2010-03-22 12:25:33 +08:00
Abderrahim Kitouni
2c65097235 fix gimport and add test for using to work on hg repos from git (issue 73) 2010-02-26 19:27:32 +01:00
jeremy avnet
c6ea6998e8 Don't import git submodule files (we don't support them .. yet). 2010-02-23 16:23:09 -05:00
Augie Fackler
fc62064c74 git_handler: use progress API instead of reinventing the wheel 2010-02-24 21:08:38 -06:00
Augie Fackler
42a1ea9ecf git_handler: slight style cleanup 2010-02-24 21:08:19 -06:00