Skip to contentSkip to conversation

buildman: Fix incorrect arguemnt in GetUpstream()

PATCH New Simon Glass 1 participant 4 messages Jan 29, 2015 – Feb 15, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 buildman: Fix incorrect arguemnt in GetUpstream()

This causes an error when trying to build a local branch which has a local branch as its upstream.

---

 tools/patman/gitutil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/patman/gitutil.py +1 -1
index cc5a55a..9a40f68 100644
@@ -129,7 +129,7 @@ def GetUpstream(git_dir, branch):
         return upstream, msg
 
     if remote == '.':
-        return merge
+        return merge, None
     elif remote and merge:
         leaf = merge.split('/')[-1]
         return '%s/%s' % (remote, leaf), None
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH 1/2 buildman: Fix incorrect arguemnt in GetUpstream()

Quoted 24 lines · Simon Glass

This causes an error when trying to build a local branch which has a local branch as its upstream.

---

 tools/patman/gitutil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/patman/gitutil.py +1 -2
index cc5a55a..9a40f68 100644
@@ -129,7 +129,7 @@ def GetUpstream(git_dir, branch):
         return upstream, msg
 
     if remote == '.':
-        return merge
+        return merge, None
     elif remote and merge:
         leaf = merge.split('/')[-1]
         return '%s/%s' % (remote, leaf), None
--
Quoted 2 lines

2.2.0.rc0.207.ga3a616c

Applied to u-boot-x86/sandbox.

#2 lore raw

PATCH 2/2 patman: Read in the git-mailrc alias file

In reply to Simon Glass

We should read this file to obtain a set of aliases. This reduces the need to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the help but it did not find its way upstream.

---

 tools/patman/settings.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
tools/patman/settings.py +27 -0
index 122e8fd..ba2a68f 100644
@@ -235,6 +235,31 @@ def _UpdateDefaults(parser, config):
         else:
             print "WARNING: Unknown setting %s" % name
 
+def _ReadAliasFile(fname):
+    """Read in the U-Boot git alias file if it exists.
+
+    Args:
+        fname: Filename to read.
+    """
+    if os.path.exists(fname):
+        bad_line = None
+        with open(fname) as fd:
+            linenum = 0
+            for line in fd:
+                linenum += 1
+                line = line.strip()
+                if not line or line.startswith('#'):
+                    continue
+                words = line.split(' ', 2)
+                if len(words) < 3 or words[0] != 'alias':
+                    if not bad_line:
+                        bad_line = "%s:%d:Invalid line '%s'" % (fname, linenum,
+                                                                line)
+                    continue
+                alias[words[1]] = [s.strip() for s in words[2].split(',')]
+        if bad_line:
+            print bad_line
+
 def Setup(parser, project_name, config_fname=''):
     """Set up the settings module by reading config files.
 
@@ -244,6 +269,8 @@ def Setup(parser, project_name, config_fname=''):
             for sections named "project_section" as well.
         config_fname:   Config filename to read ('' for default)
     """
+    # First read the git alias file if available
+    _ReadAliasFile('doc/git-mailrc')
     config = _ProjectConfigParser(project_name)
     if config_fname == '':
         config_fname = '%s/.patman' % os.getenv('HOME')
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#3 lore raw

PATCH 2/2 patman: Read in the git-mailrc alias file

Quoted 6 lines · Simon Glass

We should read this file to obtain a set of aliases. This reduces the need to create them in the ~/.patman file.

This feature did exist in some version of patman, and is mentioned in the help but it did not find its way upstream.

Quoted 6 lines

---

 tools/patman/settings.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

I did not get any test feedback on this one. I'll apply it and see if anyone see any problems.

Applied to u-boot-x86/sandbox.