I spent some time on the Mercurial adapter. I made two changes that I purpose to you :
- I wrote a new revisions method that parses changesets with only one call to the hg program. I use a template that makes hg output the changelog in XML. I put the templates in extra/mercurial. There are two templates because the templating syntaxe changed a bit with Mercurial 1.0. I did not make benchmarks but I think it's slightly faster than the actual method. This new method also fetch informations about copied files.
- I made changes on the entries method to be able to browse the repository at any revision. The actual method cannot list directories that do not exist in the present revision.
I tested my code on Linux with Mercurial 0.9.5 and on Windows with Mercurial 1.0.
#2 Updated by Frédéric Moulins over 9 years ago
- File patch-1199_against_r1441.patch added
thanks for the solution !Your patch didn't applied cleanly, there was a problem with hunk 2 of mercurial_adapter.rb.
Here is your patch with a few modifications :
- use of
cmd << " -r " + (identifier ? identifier.to_s : "tip")(I think this line caused your patch to not apply).
- use of the same trick for cat and annotate, to be able to see files at a specific revision.
I tested on a Linux machine with Mercurial 1.0.
Could you test it again with both versions of Mercurial and on Windows ?
#3 Updated by Jean-Philippe Lang over 9 years ago
This patch applies cleanly on the latest code. But it breaks this unit test:
It looks like the commit message is truncated to the first line. I'm running hg 1.0 on win32.
Also I think that
MercurialAdapter.template_path is not accurate.
Here is my output of hg --version:
Mercurial Distributed SCM (version 1e4ddc9ac9f7+20080325) Copyright (C) 2005-2008 Matt Mackall <email@example.com> and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Maybe we could choose the 1.0 template if it doesn't match something like:
/version (\d+(\.\d+)*)/ ?
#4 Updated by Paul Rivier over 9 years ago
here is my output for hg --version. First is for .9.5, second is for 1.0. System is debianish, .9.5 is provided by distro repository, 1.0 is built from hg sources.
Mercurial Distributed SCM (version 0.9.5)
Mercurial Distributed SCM (version 1.0)
Jean Philippe, how did you get your copy of HG ?
By the way, a fallback as suggested is probably safe.
#6 Updated by Pierre Paysant-Le Roux over 9 years ago
- File patch-redmine-mercurial.patch added
Here is a new patch that passes unit tests. In fact, all the commit messages where truncated.
Is there a way to obtain the repositories used for unit testing ?
I modified the behaviour for the template selection. If the version number is not a version number (ie it's not an official release), then the template1.0 is used. I asked the Mercurial packager for Windows why he don't use official releases.
#7 Updated by Jean-Philippe Lang over 9 years ago
Pierre, the repository used for unit and functionnal tests can be found in
Extract it into
tmp/test as documented in source:/trunk/doc/RUNNING_TESTS :
gunzip < test/fixtures/repositories/mercurial_repository.tar.gz | tar -xv -C tmp/test
I did not do a full review of your patch but tests are OK. Do you think it's ready for commit ?
#9 Updated by Jean-Philippe Lang over 9 years ago
- Status changed from New to Closed
- Target version set to 0.8
Patch committed in r1499.
I made a small change in order to move the templates from
/lib/redmine/scm/adapters/mercurial since the adapter depends on these files.
Thanks for your work.