buildman: Try to guess the upstream commit
Buildman normally obtains the upstream commit by asking git. Provided that the branch was created with 'git checkout -b <branch> <some_upstream>' then this normally works. When there is no upstream, we can try to guess one, by looking up through the commits until we find a branch. Add a function to try this and print a warning if buildman ends up relying on it. Also update the documentation to match. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
@@ -310,8 +310,9 @@ branch with a valid upstream)
|
||||
$ ./tools/buildman/buildman -b <branch> -n
|
||||
|
||||
If it can't detect the upstream branch, try checking out the branch, and
|
||||
doing something like 'git branch --set-upstream <branch> upstream/master'
|
||||
or something similar.
|
||||
doing something like 'git branch --set-upstream-to upstream/master'
|
||||
or something similar. Buildman will try to guess a suitable upstream branch
|
||||
if it can't find one (you will see a message like" Guessing upstream as ...).
|
||||
|
||||
As an example:
|
||||
|
||||
|
||||
@@ -127,12 +127,12 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None,
|
||||
if not options.branch:
|
||||
count = 1
|
||||
else:
|
||||
count = gitutil.CountCommitsInBranch(options.git_dir,
|
||||
options.branch)
|
||||
count, msg = gitutil.CountCommitsInBranch(options.git_dir,
|
||||
options.branch)
|
||||
if count is None:
|
||||
str = ("Branch '%s' not found or has no upstream" %
|
||||
options.branch)
|
||||
sys.exit(col.Color(col.RED, str))
|
||||
sys.exit(col.Color(col.RED, msg))
|
||||
if msg:
|
||||
print col.Color(col.YELLOW, msg)
|
||||
count += 1 # Build upstream commit also
|
||||
|
||||
if not count:
|
||||
|
||||
Reference in New Issue
Block a user