From patchwork Sat Dec 15 20:42:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 206641 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5CD1C2C008E for ; Sun, 16 Dec 2012 07:43:28 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 57BE04A128; Sat, 15 Dec 2012 21:43:22 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OkoTt8fmDW43; Sat, 15 Dec 2012 21:43:22 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E9F894A12D; Sat, 15 Dec 2012 21:42:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E56434A0FC for ; Sat, 15 Dec 2012 21:42:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KAMpw487BN05 for ; Sat, 15 Dec 2012 21:42:49 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-qc0-f202.google.com (mail-qc0-f202.google.com [209.85.216.202]) by theia.denx.de (Postfix) with ESMTPS id 229F94A105 for ; Sat, 15 Dec 2012 21:42:37 +0100 (CET) Received: by mail-qc0-f202.google.com with SMTP id s25so476317qcq.3 for ; Sat, 15 Dec 2012 12:42:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=qE2x7V4qw9dY0xOmkfPHCmicggaIuBoMzIpinNjNTs0=; b=nv7Lg0KP1pVeqNHjEqA243Up+hg4BXiMnKW3z23HFAFC8HE+OZYeQ3JAxBrKj8dAeC IN1d0YlVbI8Xmrv4LMvDT3lvbwb39/cLJtSkV1gEEX8s04ulqLoKpmDayfbuY3haUsK0 eWMfnSYACLInZ2KaM0uQnSe+abbdcuWRh6BVFUUpCGg5VtBBdWxwVe4U8w6t73Im3+zl xdtjW3JcHP11GtGc9qc/zGFqdZs1h3jVjM8xSZX3q2SnRJcGDIf2+cHp+nc4WJcb2hyq QlGEcN5e3Ii0xw37kVDagQxh2pXm1UsOHe7nANHg/GX0Y5A22pR9vlqJNr82jbCUeapR 8khg== Received: by 10.236.116.10 with SMTP id f10mr2246345yhh.9.1355604156894; Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id u20si402124anj.3.2012.12.15.12.42.36 (version=TLSv1/SSLv3 cipher=AES128-SHA); Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id A9FEE100048; Sat, 15 Dec 2012 12:42:36 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 5D56E160D8C; Sat, 15 Dec 2012 12:42:36 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Sat, 15 Dec 2012 12:42:06 -0800 Message-Id: <1355604128-12938-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1355604128-12938-1-git-send-email-sjg@chromium.org> References: <1355604128-12938-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQnRvDiMDw4rsHsrKfzyvcPB2b9gv15248k8rTbmbAv5xch+XZGMl7dTQTjM4ACHfrPJXITbh5Rla9p9VaqJ7Rvvz+6d+axRgidvgRgEsJOjsh/24ZrWlZmjiBhgfSRTjtUDJSChvl0MVQuIgq+mOP2mzyx+iKYPGP9sTFP5QMg+Uk6cg2i7p8p/KFMY/pVbRAde2Q5K Cc: Tom Rini Subject: [U-Boot] [PATCH v2 6/8] patman: Allow reading metadata from a list of commits X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de We normally read from the current branch, but buildman will need to look at commits from another branch. Allow the metadata to be read from any list of commits, to provide this flexibility. Signed-off-by: Simon Glass --- Changes in v2: None tools/patman/patchstream.py | 36 +++++++++++++++++++++++++++++------- 1 files changed, 29 insertions(+), 7 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 1e4a36f..bed921d 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -237,7 +237,8 @@ class PatchStream: # Detect the start of a new commit elif commit_match: self.CloseCommit() - self.commit = commit.Commit(commit_match.group(1)[:7]) + # TODO: We should store the whole hash, and just display a subset + self.commit = commit.Commit(commit_match.group(1)[:8]) # Detect tags in the commit message elif tag_match: @@ -334,26 +335,47 @@ class PatchStream: self.Finalize() -def GetMetaData(start, count): +def GetMetaDataForList(commit_range, git_dir=None, count=None, + series = Series()): """Reads out patch series metadata from the commits This does a 'git log' on the relevant commits and pulls out the tags we are interested in. Args: - start: Commit to start from: 0=HEAD, 1=next one, etc. - count: Number of commits to list + commit_range: Range of commits to count (e.g. 'HEAD..base') + git_dir: Path to git repositiory (None to use default) + count: Number of commits to list, or None for no limit + series: Series object to add information into. By default a new series + is started. + Returns: + A Series object containing information about the commits. """ - pipe = [['git', 'log', '--no-color', '--reverse', 'HEAD~%d' % start, - '-n%d' % count]] + params = ['git', 'log', '--no-color', '--reverse', commit_range] + if count is not None: + params[2:2] = ['-n%d' % count] + if git_dir: + params[1:1] = ['--git-dir', git_dir] + pipe = [params] stdout = command.RunPipe(pipe, capture=True).stdout - series = Series() ps = PatchStream(series, is_log=True) for line in stdout.splitlines(): ps.ProcessLine(line) ps.Finalize() return series +def GetMetaData(start, count): + """Reads out patch series metadata from the commits + + This does a 'git log' on the relevant commits and pulls out the tags we + are interested in. + + Args: + start: Commit to start from: 0=HEAD, 1=next one, etc. + count: Number of commits to list + """ + return GetMetaDataForList('HEAD~%d' % start, None, count) + def FixPatch(backup_dir, fname, series, commit): """Fix up a patch file, by adding/removing as required.