Commit Graph

712 Commits

Author SHA1 Message Date
Augie Fackler
7591ece88a setup: bump version 2013-12-14 12:03:54 -05:00
Augie Fackler
0de600a5da test-subrepos.t: hide output from newer hg versions about active bookmarks 2013-12-14 12:00:09 -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
Augie Fackler
cbc2e09223 test-timezone.t: add missing (but needed) trailing whitespace 2013-12-13 12:42:55 -05:00
Augie Fackler
1a8f8d54f1 tests: dulwich is now smarter about sending fewer objects, update output 2013-12-13 12:41:41 -05:00
Augie Fackler
84484d7ab2 setup: bump dep on dulwich to 0.9.4 2013-12-13 12:34:06 -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
2482dd2dd8 Merge pull request #249 from warner/improve-readme
README: add URLs of homepage, primary hg repo, and git mirror repo
2013-10-05 14:46:10 -07: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
d502e713c1 Updated setup.py file to reflect requirement on newer version of dulwich package. 2013-09-13 02:41:36 +01:00
Alex Regueiro
a5c98b616b Upgraded to use latest version of dulwich (0.9.1). 2013-09-13 01:42:27 +01:00
Augie Fackler
5b6275ec8c test-subrepos: cope with unsorted output in .hgsub 2013-08-28 13:52:38 -04:00
Augie Fackler
ff1e9014cf merge 2013-08-28 13:49:01 -04:00
Augie Fackler
c455d88068 Update test output to handle 65d8a43b adding some more objects. 2013-08-28 13:41:22 -04:00
Augie Fackler
8032d62596 test-tree-decomposition: work around git command format changes 2013-08-28 11:27:13 -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
aea14993e9 Add test to show dulwich fault on invalid timezone data
A recent real world occurrence - user hand edited the timezone field in
an hg export to provide a unique value (from prior export). Hg imported
the export okay, but dulwich threw an exception.

This test shows the fault.
2013-02-06 17:35:08 -08: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
David M. Carr
04a92f210c tests: use fn_git_commit in test-encoding.t
In f32e473ff520, the "commit" function was extracted into a testutil for re-use.
However, test-encoding.t was skipped over in that changeset, as I was seeing
unexplained test failures.  Since those test failures have now been explained
(and fixed), this changeset performs the same extraction on test-encoding.t as
was done on all the other tests.

The version of fn_git_commit that was used in testutil redirected all output
(including errors) to /dev/null, which didn't match the expectations of this
test.  The test utility functions for commit/tag now no longer throw away error
output, instead leaving it to individual tests to decide if error output should
be ignored.
2012-11-03 22:36:13 -04:00
David M. Carr
d41ee25025 tests: make test-encoding.t compatible with git 1.8.0
It looks like Git 1.8.0 started silently converting latin1 commit messages to
utf-8.  That changed the result of this test.  This changeset alters the test
to make it accept both the pre-1.8.0 and post-1.8.0 behaviors.

https://raw.github.com/git/git/master/Documentation/RelNotes/1.8.0.txt
2012-11-03 22:22:43 -04:00
David M. Carr
514b502815 tests: remove filterhash from test-incoming.t
This test had some form of legacy hash filtering, marked with a TODO to remove
it when we're only supporting Mercurial 1.5 or later.  Well, that time has
come, so I removed it.
2012-11-03 19:25:13 -04:00
David M. Carr
a3edcfce3e tests: remove mercurial version check from test-incoming.t
This test was only running on Mercurial 1.7 or later.  Since now we only
support versions that are 1.7 or later, there isn't a need to perform this
check any more.
2012-11-03 19:20:52 -04:00
David M. Carr
c0ec4f8882 tests: remove mercurial version check from test-pull-after-strip.t
This test was being skipped in Mercurial < 1.5.  We don't support Mercurial
that old any more, so there isn't a need to worry about it in the tests.
2012-11-03 19:20:39 -04:00
David M. Carr
7fc5793d3d tests: convert echos to comments
Now that we're in the unified test format, there isn't a need to use echo
to provide context to command output.  This technique actually ends up resulting
in redundant output.  To preserve the original context, but eliminate the
redundancy, such echo statements have been converted into comment lines.
2012-11-03 19:14:17 -04:00
David M. Carr
ef24ee33fc tests: avoid changing the current directory
Mercurial allows specifying which repository to use via the -R/--repository
option.  Git allows a similar function using the --git-dir option.  By using
these options, in many cases we can avoid checking the current directory.
This makes tests easier to understand, as you don't need to remember which
directory you're in to understand what's going on.  It also makes tests easier
to write, as you don't need to remember to cd out of a directory when you're
done doing things there.

Thanks to Felipe Contreras for the patch which this was based on.
2012-11-03 19:12:08 -04:00
David M. Carr
33f1efdddf tests: extract git command-line client and dulwich requirements into testutil
One or both of these requirements were in almost every test in exactly the same
way.  Now, these checks are performed in every test that uses the testutil.
This makes it easier for test authors to add these checks into new tests (just
add a reference to the testutil, which you'd probably want anyway).

We considered having each test declare their requirements (currently, either
"git" or "dulwich"), but in this case, preferred the simplicity of having the
check always performed (even if a particular test doesn't need one or the
other).  You can't perform any meaningful testing of Hg-Git without both of
these dependencies properly configured.  The main value to checking for them
in the tests (rather than just letting the tests fail) is that it gives a
meaningful error message to help people figure out how to fix their environment.
In the case that either git or dulwich is missing, the information will be
just as clearly conveyed regardless of whether its all the tests that are
skipped, or just most of them.

I didn't add dulwich to hghave (even though this is clearly the sort of thing
that hghave is intended for) because hghave is currently pulled from Mercurial
completely unchanged, and it's probably best to keep it that way.

Tested by running the tests in three configurations:
 * No dulwich installed (ran 0, skipped 28, failed 0, output:
        Skipped *: missing feature: dulwich)
 * Bad git on path (ran 1, skipped 27, failed 0, output:
        Skipped *: missing feature: git command line client)
 * Working git and correct version of dulwich installed
        (ran 28, skipped 0, failed 0)

Thanks to Felipe Contreras for the idea to extract this logic into a library.
2012-11-03 19:11:50 -04:00
Augie Fackler
b755ef1641 Release 0.3.4 2012-11-01 09:10:59 -05:00
David M. Carr
905e581176 tests: let git init create directories when applicable
It's functionally equivalent to create a directory, cd into it, git init, and
cd out of the directory, or simply git init with the directory specified.

In several cases, we were doing the former without performing any other
operations in the git repo, which just made the test unneccesarily complex.
Even in the case where we still want to cd into the directory, calling git
init with the directory name eliminates the need for a separate mkdir command.

This changeset converts the former approach to the latter with the goal of
increasing the readability of the tests.

Thanks to Felipe Contreras for the patch which this was based on.
2012-10-31 00:01:03 -04:00
David M. Carr
1abce70deb tests: add check for dulwich in test-url-parsing.py
Previously, if dulwich wasn't available, this test would fail with a traceback
(example included below).  This changeset makes it so that the test will be
skipped with an informative message if dulwich isn't available.

Traceback (most recent call last):
  File "/Users/carrd/hg-repos/hg-git-queue/tests/test-url-parsing.py", line 6, in <module>
    from hggit.git_handler import GitHandler
  File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/__init__.py", line 42, in <module>
    import gitrepo, hgrepo
  File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/gitrepo.py", line 13, in <module>
    from git_handler import GitHandler
  File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/git_handler.py", line 4, in <module>
    from dulwich.errors import HangupException, GitProtocolError, UpdateRefsError
ImportError: No module named dulwich.errors
2012-10-30 23:16:07 -04:00
David M. Carr
d1a4bffd12 tests: extract commonly used commit/tag functions into testutil library
Thanks to Felipe Contreras for the patch which this was based on.

The functions were renamed to make it clearer that these are shell functions
rather than normal git/hg commands, and to make it clearer which tool is being
invoked.

Old name | New name
------------------------
commit   | fn_git_commit
tag      | fn_git_tag
hgcommit | fn_hg_commit
hgtag    | fn_hg_tag

Extraction from test-encoding.t was left for a subsequent patch, as I was seeing
unexpected output changes when I attempted the extraction.

The gitcommit and hgcommit functions in test-bookmark-workflow.t were left
as-is for now, as they have a different behavior than the standard version
(separate counters for each).
2012-10-30 22:59:20 -04:00