Provide deb-version substitute {svn}

Bug #412722 reported by Dimitri John Ledkov
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
bzr-builder
Fix Released
Low
Jelmer Vernooij

Bug Description

Bzr can handle svn, git and a little bit of hg.

I'm turning into daily builds a svn based project. It has a bzr branch on launchpad and all is fine.

But in the daily builds I'd rather have +svn{revno:svn} instead of +bzr{revno}.

Upstream hasn't switched to bzr yet (I'm trying ;-) ) and it would be nice to be able to report svn revision numbers instead of revision number bzr-svn came up with (there is a difference)

ps. this is not svn native co which is operated with bzr. It's a bzr-svn branch eg bzr branch https://svn repo =)

Feel free to experiment with lp:xiphos it has ~1000 difference between bzr revision numbr and svn revision number.

Related branches

summary: - Revno for foreign branches eg svn, git, hg etc
+ Provide deb-version substitute {svn}
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Recent bzr-svn generates revno / revid which looks like this:

In [13]: b.last_revision_info()
Out[13]: (2311, 'svn-v4:95a4280c-1b0e-0410-9f8f-80a059958c3c:trunk:3257')

So to substitute {svn} in deb_version revision:

1) check that it starts with 'svn-v4'
2) And strip rev-id to last ":" and return last digits as {svn}

I've tried to write a patch myself but I failed =(

As far as I understood it a new def is required in class BaseRecipeBranch.
I took substitute as a template basis but I don't see where get_revno_cb() is defined and where should I place alternative get_svn_revno_cb() which will return svn revision as bisected above.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Just to clarify 2311 is bzr revno and 3257 is svn revno on the trunk branch.

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 412722] Re: Provide deb-version substitute {svn}

Dmitrijs Ledkovs wrote:
> Recent bzr-svn generates revno / revid which looks like this:
>
> In [13]: b.last_revision_info()
> Out[13]: (2311, 'svn-v4:95a4280c-1b0e-0410-9f8f-80a059958c3c:trunk:3257')
>
> So to substitute {svn} in deb_version revision:
>
> 1) check that it starts with 'svn-v4'
> 2) And strip rev-id to last ":" and return last digits as {svn}

I think bzr-svn can tell you the svn revno for a revision. I'm not sure
if it writes the metadata or does something similar to what you suggest.
I think re-using the code from bzr-svn would be good though. I haven't
had a chance to look at the source to find out what it does yet.

> I've tried to write a patch myself but I failed =(
>
> As far as I understood it a new def is required in class BaseRecipeBranch.
> I took substitute as a template basis but I don't see where get_revno_cb() is defined and where should I place alternative get_svn_revno_cb() which will return svn revision as bisected above.

It's implemented as a callback because it is potentially expensive, but
that might help implementing this.

get_revno is a function defined inline in the _resolve_revisions_recurse
function, see line 215 of recipe.py.

Thanks,

James

Changed in bzr-builder:
status: New → In Progress
James Westby (james-w)
Changed in bzr-builder:
importance: Undecided → Low
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Well if you use bzr-svn and commit & push to svn it appears as regular bzr commit and you can't get svn revno out of it. So this substitute is really useless unless it can be generalized to {maybe-exists-foreign-id}........

Changed in bzr-builder:
status: In Progress → Invalid
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

This isn't quite true, you would still be able to get a Subversion revision number out of it if the remote branch is itself a Subversion repository.

Changed in bzr-builder:
status: Invalid → Confirmed
Jelmer Vernooij (jelmer)
tags: added: extra-substvars
Changed in bzr-builder:
status: Confirmed → Triaged
Jelmer Vernooij (jelmer)
Changed in bzr-builder:
status: Triaged → In Progress
assignee: nobody → Jelmer Vernooij (jelmer)
Jelmer Vernooij (jelmer)
Changed in bzr-builder:
status: In Progress → Fix Committed
Jelmer Vernooij (jelmer)
Changed in bzr-builder:
milestone: none → 0.7
Jelmer Vernooij (jelmer)
Changed in bzr-builder:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.