Commit Graph

18 Commits

Author SHA1 Message Date
Siddharth Agarwal
9857ee8482 tests: stop filtering out bookmark output
The bookmark output has been stable since well before the oldest Mercurial we
support, 2.8.
2015-03-12 10:29:58 -07:00
Siddharth Agarwal
e7b4906871 git_handler: mark source for rename info as Git or Mercurial
See inline comments for why the additional metadata needs to be stored.

This literally breaks all the hashes because of the additional metadata. The
changing of hashes is unfortunate but necessary to preserve bidirectionality.

While this could be broken up into multiple commits, there was no way to do
that while preserving bidirectionality. Following the principle that every
intermediate commit must result in a correct state, I decided to combine the
commits.
2014-12-02 14:17:09 -08:00
Siddharth Agarwal
a6b1e5863c test-encoding: remove support for Git 1.7.x
Git 1.8.0 was released in late 2012. Given that we only support versions of
Mercurial released in 2014, it doesn't make sense to support versions of Git
this old.
2014-12-04 18:31:42 -08:00
Siddharth Agarwal
ed8599fcd4 git_handler: export hg extra metadata as git extra metadata (issue121)
We export new git commits with hg extra metadata stored as git extra fields.
We also ensure that parsing old commits doesn't break.
2014-08-31 14:01:07 -07: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
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
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
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
8d69bf5e9a tests: extract extension configuration into a testutil library
Thanks to Felipe Contreras for the patch which this was based on.

Even though the MQ extension was only used in a single test
(test-pull-after-strip.t), I included it in the testutil.  It shouldn't hurt
anything to have it enabled and not used, and saves us from having to deal
with enabling extensions in individual tests at all.

Similarly, this changeset results in the graphlog extension being enabled
for all tests, even though there were some that didn't use it before.  This is
even less significant in Mercurial 2.3+, since in those versions, graphlog is
part of core, and is available even when the extension is disabled.
2012-10-30 20:03:26 -04:00
David M. Carr
57982de0d4 tests: uncomment calls to hghave git
Now that hghave git works properly, uncomment the calls, and add ones that were
missing.
2012-10-29 00:17:55 -04: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
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
f6564520bb tests: eliminate use of git-daemon
Dulwich now supports local repositories just fine.  Not using the daemon makes
the tests easier to read and more reliable (less likely to be skipped because
a stray daemon is holding onto the port).
2012-09-13 20:49:45 -04:00
David M. Carr
77a9e3062f tests: remove piping of command git init to remove leading path
In many cases we were piping to a python script to strip out the varying leading
path to the test repos.  This is no longer needed, as the modern run-test.py
automatically substitutes the leading path as $TESTTMP.  Eliminating the piping
makes the tests easier to read and write, as well as allowing the exit codes
to be verified by the test.
2012-09-13 20:49:42 -04:00
David M. Carr
91ca9b4626 tests: remove configuration of bookmarks extension
All of our supported Hg versions include bookmarks in core.  Thus, actovating
it in the hgrc and setting bookmarks.track.current are no longer needed.
2012-09-13 20:48:11 -04:00
David M. Carr
2b053b0765 tests: unify test-encoding 2012-09-11 18:51:19 -04:00