# HG changeset patch # User Francisco J Ballesteros # Date 1316189159 -7200 # Node ID f014b005d5f110e285cf72e77109a1c23ac47a44 # Parent 530d69deba603ab9a99e41d961f087bb00fee4ea codereview fix: new flag -a to hg change and set nix-dev as the default reviewer. The variable ignored_for_change in codereview.py contains a regexp for files ignored in the list presented to the user for hg change. The flag -a makes hg change behave as before, i.e., do not ignore any tracked file. The regexp ignores /386 and /amd64 binaries. R=nix-dev, rminnich, nemo CC=nix-dev http://codereview.appspot.com/5047042 diff -r 530d69deba60 -r f014b005d5f1 sys/lib/codereview/codereview.py --- a/sys/lib/codereview/codereview.py Thu Sep 15 22:32:19 2011 +0200 +++ b/sys/lib/codereview/codereview.py Fri Sep 16 18:05:59 2011 +0200 @@ -128,6 +128,11 @@ releaseBranch = None ####################################################################### +# RE for files ignored for hg change unless -a is given. +ignored_for_change = "^((386|amd64)/bin/|386/init$|amd64init$|acme/bin/)" + + +####################################################################### # RE: UNICODE STRING HANDLING # # Python distinguishes between the str (string of bytes) @@ -239,7 +244,7 @@ s += 'URL: ' + cl.url + ' # cannot edit\n\n' if cl.private: s += "Private: True\n" - s += "Reviewer: " + JoinComma(cl.reviewer) + "\n" + s += "Reviewer: " + "nix-dev@googlegroups.com" + JoinComma(cl.reviewer) + "\n" s += "CC: " + JoinComma(cl.cc) + "\n" s += "\n" s += "Description:\n" @@ -966,9 +971,19 @@ return path[n+1:] return path - - - +# +# return true if file should be excluded from the list of files in a +# change list edition +# +def ExcludedForChange(file): + return not re.match(ignored_for_change, file) + +# +# filter the file name list files to contain only those files that +# do not have to be excluded from a change list edition +# +def ChangedFilesNotExcluded(files): + return filter(ExcludedForChange, files) ####################################################################### # Mercurial commands @@ -1001,6 +1016,9 @@ hg revert @123456 before running hg change -d 123456. + + By default, files in /386/bin, /amd64/bin, and the like are + ignored by this command. Use flat -a to consider them as well. """ if missing_codereview: @@ -1024,7 +1042,8 @@ cl = CL("new") dirty[cl] = True files = ChangedFiles(ui, repo, pats, opts, taken=Taken(ui, repo)) - + if not opts["all"]: + files = ChangedFilesNotExcluded(files) if opts["delete"] or opts["deletelocal"]: if opts["delete"] and opts["deletelocal"]: return "cannot use -d and -D together" @@ -1819,13 +1838,14 @@ "^change": ( change, [ + ('a', 'all', None, 'consider all files for change'), ('d', 'delete', None, 'delete existing change list'), ('D', 'deletelocal', None, 'delete locally, but do not change CL on server'), ('i', 'stdin', None, 'read change list from standard input'), ('o', 'stdout', None, 'print change list to standard output'), ('p', 'pending', None, 'print pending summary to standard output'), ], - "[-d | -D] [-i] [-o] change# or FILE ..." + "[-a] [-d | -D] [-i] [-o] change# or FILE ..." ), "^clpatch": ( clpatch,