Defect #14361

Mercurial commit ids are short (12 digits) on database

Added by Claudio Bley about 5 years ago. Updated over 4 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Toshi MARUYAMA% Done:

100%

Category:SCM
Target version:2.5.0
Resolution:Fixed Affected version:2.3.1

Description

I'm using redmine 2.3.1 and configured a Mercurial repository.

Referring to a commit with the changeset id (a 40 digit hexadecimal number) redmine does not render this as a link.

Furthermore, loading projects/$p/repository/revisions/$changeset_id just gives a 404 "The entry or revision was not found in the repository." error.

Of course, the commit does exist in the repo.

select scmid from changesets; only gives the short-form ID, well, unsurprisingly.

To quote http://mercurial.selenic.com/wiki/ChangeSetID

Note: a short-form ID can start out valid, but become invalid because another changeset with the same prefix shows up later on. Do not use short-form IDs for long-lived representations. You can use the --debug option to display the full changeset ID.

long-node.diff Magnifier (5.22 KB) Toshi MARUYAMA, 2013-06-26 17:25

long-node-v2.diff Magnifier (8.71 KB) Toshi MARUYAMA, 2013-06-26 19:36

redmine_hg_long_ids_tests.diff Magnifier (10.9 KB) Claudio Bley, 2014-01-31 16:33

Associated revisions

Revision 12749
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use 12 chars id for format_changeset_identifier (#14361)

Revision 12750
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add check scmid to RepositoryMercurialTest#test_fetch_changesets_from_scratch (#14361)

Revision 12751
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split Repository::Mercurial#latest_changesets_cond for short and long id (#14361)

Revision 12752
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use long id in adapter level (#14361)

Revision 12753
Added by Toshi MARUYAMA over 4 years ago

back out r12752 (#14361)

Revision, Author and Comment of repository browser are broken.

Revision 12754
Added by Toshi MARUYAMA over 4 years ago

scm: split Repository#entries (#14361)

Revision 12755
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add method to switch short or long id by existing value in DB (#14361)

Revision 12756
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add adapter entry test (#14361)

Revision 12757
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add model entries test (#14361)

Revision 12758
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add model entry test (#14361)

Revision 12759
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: override entry and scm_entries (#14361)

Revision 12760
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: switch short or long id of entry by existing value in DB (#14361)

Revision 12761
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use long id in adapter level (#14361)

Revision 12762
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split latest_changesets tag test with limit or not (#14361)

Revision 12763
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add latest_changesets "default" branch test (#14361)

Revision 12764
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split latest_changesets tag test with path or not (#14361)

Revision 12765
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split latest_changesets default branch test to sub method (#14361)

Revision 12766
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split latest_changesets tag test to sub method (#14361)

Revision 12767
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split test_entry_short_id to sub method (#14361)

Revision 12768
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split test_entries_short_id to sub method (#14361)

Revision 12769
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split test_copied_files to sub method (#14361)

Revision 12770
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: split test_parents to sub method (#14361)

Revision 12771
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add test helper method to switch short or long id (#14361)

Revision 12772
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use scmid_for_assert in assert_copied_files (#14361)

Revision 12773
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use scmid_for_assert in assert_entry (#14361)

Revision 12774
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use scmid_for_assert in assert_entries (#14361)

Revision 12775
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: use scmid_for_assert in assert_parents (#14361)

Revision 12776
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: add asserting first and last changeset to test_fetch_changesets_from_scratch (#14361)

Revision 12777
Added by Toshi MARUYAMA over 4 years ago

scm: mercurial: insert long id to DB unless existing id in DB is not short id (#14361)

History

#1 Updated by Toshi MARUYAMA about 5 years ago

  • Subject changed from hg commit ids not supported to Mercurial commit ids are short (12 chars) on database

#2 Updated by Toshi MARUYAMA about 5 years ago

  • Target version set to 2.4.0

#3 Updated by Toshi MARUYAMA about 5 years ago

Try this patch.

#4 Updated by Toshi MARUYAMA about 5 years ago

This patch fixes some bugs of previous patch.

#5 Updated by Claudio Bley about 5 years ago

  • Status changed from New to Resolved

Toshi MARUYAMA wrote:

This patch fixes some bugs of previous patch.

It works great. Thank you very much!

One last thing though, would it be possible to shorten the link text to 12 (or even less) chars when on display? Maybe display it like

5cc4b7a919f5…

As a human a 40 chars hex number is just not something one can grasp, usually.

For example git uses 7 digits by default (more when there's a conflict), and bitbucket also displays 7 digits in its web interface.

Should I add a new ticket about this?

Thanks, again.

#6 Updated by Mischa The Evil almost 5 years ago

  • Status changed from Resolved to Confirmed

Correcting status; this is not yet committed.

#7 Updated by Jean-Philippe Lang almost 5 years ago

  • Assignee set to Toshi MARUYAMA

Toshi, should we commit this for 2.4.0?

#8 Updated by Toshi MARUYAMA almost 5 years ago

  • Target version deleted (2.4.0)

Jean-Philippe Lang wrote:

Toshi, should we commit this for 2.4.0?

Sorry, I don't have a time.

#9 Updated by Toshi MARUYAMA almost 5 years ago

My patch breaks some tests and need to add more tests.

#10 Updated by Jean-Philippe Lang almost 5 years ago

OK no problem, thanks.

#11 Updated by Claudio Bley over 4 years ago

Hi.

Just wanted to check in on you whether you made some progress on this one?

I tried the patch on the latest release and it still applies perfectly.

I'm attaching a patch which removes one minor nit and also fixes all the failing tests.

Hope you get to include this into the next release... :)

Cheers.

#12 Updated by Toshi MARUYAMA over 4 years ago

  • Subject changed from Mercurial commit ids are short (12 chars) on database to Mercurial commit ids are short (12 digits) on database

#13 Updated by Toshi MARUYAMA over 4 years ago

  • Target version set to 2.5.0
  • % Done changed from 0 to 100

#14 Updated by Jean-Philippe Lang over 4 years ago

Toshi, can we close this one?

#15 Updated by Toshi MARUYAMA over 4 years ago

  • Status changed from Confirmed to Closed
  • Resolution set to Fixed

In repository which created before 2.4, commit id length keeps 12 digits.
New repository which created after 2.5, commit id length is full (40 digits).

Also available in: Atom PDF