プロジェクト

全般

プロフィール

Vote #63187

完了

Mercurial adapter

Admin Redmine さんが約3年前に追加. 約3年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2008/05/07
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
2
issue_org_id:
1199
author_id:
993
assigned_to_id:
0
comments:
9
status_id:
5
tracker_id:
3
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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.


journals

This new version of the patch resolves issue #1241.
--------------------------------------------------------------------------------
Hello,

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 @to_s@ in @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 ?

Patch apply to r1441 and also to r1420.
--------------------------------------------------------------------------------
This patch applies cleanly on the latest code. But it breaks this unit test: @test_fetch_changesets_from_scratch(RepositoryMercurialTest)@.
It looks like the commit message is truncated to the first line. I'm running hg 1.0 on win32.
Any idea?

Also I think that @MercurialAdapter.template_path@ is not accurate.
Here is my output of hg --version:

<pre>
Mercurial Distributed SCM (version 1e4ddc9ac9f7+20080325)

Copyright (C) 2005-2008 Matt Mackall <mpm@selenic.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.
</pre>

Maybe we could choose the 1.0 template if it doesn't match something like: @/version (\d+(\.\d+)*)/@ ?

--------------------------------------------------------------------------------
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.

<pre> Mercurial Distributed SCM (version 0.9.5)</pre>
<pre> Mercurial Distributed SCM (version 1.0)</pre>

Jean Philippe, how did you get your copy of HG ?

By the way, a fallback as suggested is probably safe.
--------------------------------------------------------------------------------
The binary package of Mercurial for Windows is built from a snapshot and not from an official release. As a result, the version number provided by hg --version is the revision id of the compiled source.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Pierre, the repository used for unit and functionnal tests can be found in @test/fixtures/repositories@.
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 ?
--------------------------------------------------------------------------------
I made a new patch with a bit more unit tests. I think it can be commited now. The piece of code is in use for some days in our Redmine instance.
--------------------------------------------------------------------------------
Patch committed in r1499.
I made a small change in order to move the templates from @/extra@ to @/lib/redmine/scm/adapters/mercurial@ since the adapter depends on these files.
Thanks for your work.
--------------------------------------------------------------------------------


related_issues

relates,Closed,1241,Mercurial : Don't browse latest version after a 'hg push'

Admin Redmine さんが約3年前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン0.8_2 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0