Skip to contentSkip to conversation

git.py: create a branch when checkout

PATCH Superseded Robert Yang 3 participants 7 messages Jul 7, 2015 – Jul 9, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover git.py: create a branch when checkout

The following changes since commit 7a402301c9c8fa9a5262d6d29b2ea199ff0dc07a:

distro/package_regex.inc: Use GNOME_STABLE rule for vala (2015-07-02 23:08:41 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/git
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/git

Robert Yang (1):
git.py: create a branch when checkout

 bitbake/lib/bb/fetch2/git.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 git.py: create a branch when checkout

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---
 bitbake/lib/bb/fetch2/git.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +2 -1
index 2e53882..12087dd 100644
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
                 runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)
             else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d)
+                runfetchcmd("%s checkout %s -b oebuild_%s" % (ud.basecmd, \
+                            ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)
         return True
 
     def clean(self, ud, d):
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 13 lines · Robert Yang

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---
 bitbake/lib/bb/fetch2/git.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -0
index 2e53882..12087dd 100644

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 285

Quoted 7 lines
bitbake/lib/bb/fetch2/git.py +2 -1
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
                 runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)
             else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd, ud.revisions[ud.names[0]]), d)
+                runfetchcmd("%s checkout %s -b oebuild_%s" % (ud.basecmd, \
+                            ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)
         return True

Would it not make more sense to set the branch to the upstream branch name here?

Cheers,

Richard

#3 lore raw
Quoted 21 lines · On Tuesday 07 July 2015 16:17:42 Richard Purdie wrote:
Quoted 20 lines · Robert Yang

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---

 bitbake/lib/bb/fetch2/git.py |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -0
index 2e53882..12087dd 100644
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                 runfetchcmd("%s read-tree %s%s" % (ud.basecmd,
                 ud.revisions[ud.names[0]], readpathspec), d)
                 runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd,
                 d)
 
Quoted 9 lines
Quoted 6 lines
bitbake/lib/bb/fetch2/git.py +0 -1
             else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd,

ud.revisions[ud.names[0]]), d) + runfetchcmd("%s checkout
%s -b oebuild_%s" % (ud.basecmd, \ + ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)>
return True

Would it not make more sense to set the branch to the upstream branch name here?

I'd go one step further, use the upstream branch name and also set it to track the remote branch as well.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#4 lore raw
Quoted 32 lines · Paul Eggleton
Quoted 21 lines · On Tuesday 07 July 2015 16:17:42 Richard Purdie wrote:
Quoted 20 lines · Robert Yang

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---

  bitbake/lib/bb/fetch2/git.py |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -0
index 2e53882..12087dd 100644
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                  runfetchcmd("%s read-tree %s%s" % (ud.basecmd,
                  ud.revisions[ud.names[0]], readpathspec), d)
                  runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd,
                  d)
 
Quoted 9 lines
Quoted 6 lines
bitbake/lib/bb/fetch2/git.py +0 -1
              else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd,

ud.revisions[ud.names[0]]), d) + runfetchcmd("%s checkout
%s -b oebuild_%s" % (ud.basecmd, \ + ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)>
return True

Would it not make more sense to set the branch to the upstream branch name here?

Quoted 2 lines

I'd go one step further, use the upstream branch name and also set it to track the remote branch as well.

Hi Paul and RP,

I'm afraid that the ud.revisions[ud.names[0]] which is SRCREV may not point to an upstream branch or tag, please ?

// Robert

Quoted 4 lines

Cheers,
Paul

#5 lore raw
Quoted 34 lines · Robert Yang
Quoted 32 lines · Paul Eggleton
Quoted 30 lines · On Tuesday 07 July 2015 16:17:42 Richard Purdie wrote:
Quoted 22 lines · Robert Yang

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---

  bitbake/lib/bb/fetch2/git.py |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -1
index 2e53882..12087dd 100644
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                  runfetchcmd("%s read-tree %s%s" % (ud.basecmd,
                  ud.revisions[ud.names[0]], readpathspec), d)
                  runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd,
                  d)
 
              else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd,
Quoted 4 lines

ud.revisions[ud.names[0]]), d) + runfetchcmd("%s checkout
%s -b oebuild_%s" % (ud.basecmd, \ + ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)>
return True

Would it not make more sense to set the branch to the upstream branch name here?

Quoted 7 lines
Quoted 2 lines

I'd go one step further, use the upstream branch name and also set it to track the remote branch as well.

Hi Paul and RP,

I'm afraid that the ud.revisions[ud.names[0]] which is SRCREV may not point to an upstream branch or tag, please ?

ud.revisions might not, but ud.branches should. I think you want something like:

branchcmd = ""
if not ud.nobranch:

    branchcmd = "-b %s" % ud.branches[ud.names[0]]

runfetchcmd("%s checkout %s %s" % (ud.basecmd, ud.revisions[ud.names[0]], branchcmd), d)

However as Paul notes, setting it to track the upstream remote branch would also be ideal.

Cheers,

Richard

#6 lore raw

Thanks, I will send a V2.

// Robert

Quoted 60 lines · Richard Purdie
Quoted 34 lines · Robert Yang
Quoted 32 lines · Paul Eggleton
Quoted 30 lines · On Tuesday 07 July 2015 16:17:42 Richard Purdie wrote:
Quoted 22 lines · Robert Yang

Create a branch named oebuild_SRCREV when checkout the source, this makes debug easier than "(no branch)" when look into the source.

---

   bitbake/lib/bb/fetch2/git.py |    3 ++-
   1 file changed, 2 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -1
index 2e53882..12087dd 100644
@@ -280,7 +280,8 @@ class Git(FetchMethod):
                   runfetchcmd("%s read-tree %s%s" % (ud.basecmd,
                   ud.revisions[ud.names[0]], readpathspec), d)
                   runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd,
                   d)
 
               else:
-                runfetchcmd("%s checkout %s" % (ud.basecmd,
Quoted 4 lines

ud.revisions[ud.names[0]]), d) + runfetchcmd("%s checkout
%s -b oebuild_%s" % (ud.basecmd, \ + ud.revisions[ud.names[0]], ud.revisions[ud.names[0]]), d)>
return True

Would it not make more sense to set the branch to the upstream branch name here?

Quoted 7 lines
Quoted 2 lines

I'd go one step further, use the upstream branch name and also set it to track the remote branch as well.

Hi Paul and RP,

I'm afraid that the ud.revisions[ud.names[0]] which is SRCREV may not point to an upstream branch or tag, please ?

ud.revisions might not, but ud.branches should. I think you want something like:

branchcmd = ""
if not ud.nobranch:

     branchcmd = "-b %s" % ud.branches[ud.names[0]]

runfetchcmd("%s checkout %s %s" % (ud.basecmd, ud.revisions[ud.names[0]], branchcmd), d)

However as Paul notes, setting it to track the upstream remote branch would also be ideal.

Cheers,

Richard