You are here: Foswiki>Tasks Web>Item12821 (20 Aug 2014, GeorgeClark)Edit Attach

Item12821: Create FoswikirefsPlugin to map svn revisions to git hashrefs

pencil
Priority: Enhancement
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: FoswikirefsPlugin
Branches: trunk
Reported By: GeorgeClark
Waiting For: GeorgeClark
Last Change By: GeorgeClark
Part of the git migration strategy. Intention is to map old svn revision numbers to git hashrefs.

A svn rev will point to the foswiki account, core or extension repo, and the corresponding hash. However svn cross-branch commits are 1:n, so there is no way to map a single svn changeset to a single git commit. Possible solution, default to the "more important" branch.

-- GeorgeClark - 24 Mar 2014

Discovered some issues after the first implementation.

  • SVN cross-branch commits result in two or more git commits each with a unique commit hash, one for each target branch.
  • The commit hash identifiers from a locally generated git-svn clone seem to differ, particularly for the two hash id's generated with the cross-branch commit. The way to ensure they are correct is to issue a git clone from github and extract the information from that log, not the git-svn log.

The following command generates a reasonably processable results, The SVN ID followed by some noise on one line, and the git hash and abbreviated hash on the next.

 git log --format=tformat:"SVN: %<(44>,ltrunc)%B GIT: %H  %h "

SVN: ..@17445 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
 GIT: a6f16a15f91b3b5ca7170818030ae1ed2e555ecd  a6f16a1 
SVN: ..@17444 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
 GIT: 87cb1ef41f3f0b794c9c3542147809f1aacdae06  87cb1ef 

-- GeorgeClark - 25 Mar 2014

Another small tidbit, the default abbreviation for a hash is 7 characters, but git will automatically extend it to prevent collisions. In our current repo, we have 1 commit that required 10 digits, 35 require 8, the rest are all 7 digits.

git rev-list --all --abbrev=0 --abbrev-commit | grep -E '.{10,}'
b27684b179

-- GeorgeClark - 25 Mar 2014

Most of the updates for this task were checked in under Item11267. Extension now installed on foswiki.org.

-- GeorgeClark - 20 Aug 2014
 
Topic revision: r4 - 20 Aug 2014, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy