Bug 7008 - hg fetch always returns "tip" of repository
Summary: hg fetch always returns "tip" of repository
Status: RESOLVED NOTABUG
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 1.8 M3
Assignee: Aníbal Limón
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-12-02 12:42 UTC by Sebastian Schreiber
Modified: 2015-02-04 18:28 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Schreiber 2014-12-02 12:42:40 UTC
I'm not sure if this is a bug or intended behavior:

bb.fetch2.hg.Hg()._latest_revision() always returns the revision of the 'tip' of a repository.
In our case this is problematic: we have SRC_URIs with a ;tag="default", but in repositories where 'tip' points to another branch, e.g. some feature branch with more recent commits, the wrong revision is returned.

We avoid this problem by passing the user-specified revision to the hg identify command in _latest_revision():

--- a/yocto/bitbake/lib/bb/fetch2/hg.py	Tue Dec 02 11:01:39 2014 +0100
+++ b/yocto/bitbake/lib/bb/fetch2/hg.py	Tue Dec 02 11:03:48 2014 +0100
@@ -98,7 +98,7 @@
                 hgroot = ud.user + "@" + host + ud.path
 
         if command == "info":
-            return "%s identify -i %s://%s/%s" % (basecmd, proto, hgroot, ud.module)
+            return "%s identify -i %s://%s/%s --rev %s" % (basecmd, proto, hgroot, ud.module, ud.revision)
 
         options = [];
Comment 1 Aníbal Limón 2015-02-04 18:28:11 UTC
Hi Sebastian,

The current behavior is right because if you specify a rev for get latest_revision returns the same rev that you specify. In mercurial named revisions are tags.

The issue here is that the current code don't handle mercurial branches with this support you can specify a branch and get the latest_revision associated with this branch.

Kind regards,
    alimon