[OpenWrt-Devel] SVN to GIT transition

Felix Fietkau nbd at openwrt.org
Mon Oct 12 16:43:36 EDT 2015

On 2015-10-12 22:36, David Lang wrote:
> On Mon, 12 Oct 2015, Felix Fietkau wrote:
>> On 2015-10-12 22:28, David Lang wrote:
>>> On Mon, 12 Oct 2015, Felix Fietkau wrote:
>>>> On 2015-10-12 22:02, Javier Domingo Cansino wrote:
>>>>>     Would it be possible to track the revision number in an automated
>>>>>     way even in a git repo?  So store the r number, and automatically
>>>>>     increment on commits.  Not sure if that's an option, but it seems
>>>>>     like it might address the problem.
>>>>> In git you wouldn't need such thing, the way would be to track the
>>>>> forking point comparing the user history with the upstream master
>>>>> history, and describing the path. The oneliner I sent before (which I
>>>>> now realize I split in two), did (or will do) the following.
>>>>> 1) Go back in history and find the latest tag, save it as $tag
>>>> We currently don't have any tags for mainline trunk, since we usually
>>>> don't directly release from it.
>>> I would put a nightly tag in place (tags are pretty cheap)
>> Sounds nasty.
> why?
If we want to tag minor releases, the real release tags get hidden
behind an ever growing amount of auto-generated tag spam.

>>>>> 2) Find the forking point between upstream and user branch if any, save
>>>>> current commit if not such fork exists as $parent.
>>>> How does the script know which one is the right upstream?
>>> git knows where it was cloned from, so it knows what upstream is for any local
>>> branch.
>> Yeah, but where it was cloned from might not be OpenWrt upstream.
> true, but if you work from tags, it can just look for the difference since the 
> most recent tag (or even the most recent tag that matches a specific pattern)
>>>>> 3) count how many commits are from $tag commit to $parent commit, save
>>>>> it as $parent_n
>>>>> 3) If fork exists, count how many commits from $parent to HEAD, save it
>>>>> as $commit_n
>>>>> 4) If tree is dirty, save $dirty='-dirty', else $dirty=''
>>>>> compose the build version info as the following:
>>>>> $tag-$parent_n-$parent-$commit_n-$parent$dirty
>>>> If I see such a string, how do I look up the last OpenWrt commit from
>>>> that? With the revision number, I simply start git log and search for
>>>> @<number>
>>> if you make a nightly/weekly tag it becomes trivial to lookup. you can also use
>>> the first 6/8 characters of the git commit and look that up (or git log
>>> 12345678..HEAD to show everything between that commit and the current head)
>> The lookup only works if the tags were carried over as well. Not sure if
>> that's the case when somebody does a github fork of the mirror repo.
> tags are carried over in just about all cases (github does so by default, 
> while there are manual ways to not get them, that will cause people other 
> problems), commit hashes are an intrinsic part of the repo.
Good to know.

- Felix
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list