[OpenWrt-Devel] SVN to GIT transition

David Lang david at lang.hm
Mon Oct 12 16:28:40 EDT 2015


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)

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

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

David Lang
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list