diff options
| author | Russ Cox <rsc@golang.org> | 2012-01-30 13:41:29 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-01-30 13:41:29 -0500 |
| commit | deeb1b36ddd7a59871d7e6bb088cf06c71da5ebd (patch) | |
| tree | 040ee76a5ad5817603ef29e00db6629c7160904f /lib | |
| parent | 9c497443ae0aca6ae5b66dfa6d3127c8605bd3a8 (diff) | |
| download | go-deeb1b36ddd7a59871d7e6bb088cf06c71da5ebd.tar.xz | |
codereview: ignore test files during 'hg gofmt'
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5581047
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/codereview/codereview.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py index 7630cdfe56..56ccb508db 100644 --- a/lib/codereview/codereview.py +++ b/lib/codereview/codereview.py @@ -895,7 +895,7 @@ def CheckFormat(ui, repo, files, just_warn=False): # Check that gofmt run on the list of files does not change them def CheckGofmt(ui, repo, files, just_warn): - files = [f for f in files if (not f.startswith('test/') or f.startswith('test/bench/')) and f.endswith('.go')] + files = gofmt_required(files) if not files: return cwd = os.getcwd() @@ -1749,7 +1749,7 @@ def gofmt(ui, repo, *pats, **opts): return codereview_disabled files = ChangedExistingFiles(ui, repo, pats, opts) - files = [f for f in files if f.endswith(".go")] + files = gofmt_required(files) if not files: return "no modified go files" cwd = os.getcwd() @@ -1766,6 +1766,9 @@ def gofmt(ui, repo, *pats, **opts): raise hg_util.Abort("gofmt: " + ExceptionDetail()) return +def gofmt_required(files): + return [f for f in files if (not f.startswith('test/') or f.startswith('test/bench/')) and f.endswith('.go')] + ####################################################################### # hg mail |
