[PATCH] check-code: indent 4 spaces in py files
Augie Fackler
raf at durin42.com
Mon Jul 30 21:59:39 CDT 2012
Sounds like a good idea to me, I mess this up on my workstation somewhat regularly and usually catch it right before mailing.
On Jul 30, 2012, at 8:32 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1343698242 -7200
> # Branch stable
> # Node ID b0e06d0d49c45dc04b49f857ee89ef0c9e1921a7
> # Parent 8da6fe276a23dbb71a17ae5590de4f7e65be6136
> check-code: indent 4 spaces in py files
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -206,6 +206,7 @@
> (r'\.debug\(\_', "don't mark debug messages for translation"),
> (r'\.strip\(\)\.split\(\)', "no need to strip before splitting"),
> (r'^\s*except\s*:', "warning: naked except clause", r'#.*re-raises'),
> + (r':\n( )*( ){1,3}[^ ]', "must indent 4 spaces"),
> ],
> # warnings
> [
> diff --git a/contrib/hgfixes/fix_bytes.py b/contrib/hgfixes/fix_bytes.py
> --- a/contrib/hgfixes/fix_bytes.py
> +++ b/contrib/hgfixes/fix_bytes.py
> @@ -74,7 +74,7 @@
> 'setattr' in sggparent or \
> 'encode' in sggparent or \
> 'decode' in sggparent:
> - return False
> + return False
>
> return True
>
> diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
> --- a/hgext/largefiles/lfcommands.py
> +++ b/hgext/largefiles/lfcommands.py
> @@ -121,7 +121,7 @@
> shutil.rmtree(rdst.root)
>
> def _addchangeset(ui, rsrc, rdst, ctx, revmap):
> - # Convert src parents to dst parents
> + # Convert src parents to dst parents
> parents = _convertparents(ctx, revmap)
>
> # Generate list of changed files
> @@ -506,7 +506,7 @@
> # because otherwise the largefile will get reverted. But for commit's
> # sake, we have to mark the file as unclean.
> if getattr(repo, "_isrebasing", False):
> - lfdirstate.normallookup(lfile)
> + lfdirstate.normallookup(lfile)
> else:
> lfdirstate.normal(lfile)
> elif state == 'r':
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -667,9 +667,9 @@
> repo._isrebasing = True
> try:
> if opts.get('update'):
> - del opts['update']
> - ui.debug('--update and --rebase are not compatible, ignoring '
> - 'the update flag\n')
> + del opts['update']
> + ui.debug('--update and --rebase are not compatible, ignoring '
> + 'the update flag\n')
> del opts['rebase']
> cmdutil.bailifchanged(repo)
> origpostincoming = commands.postincoming
> diff --git a/hgext/transplant.py b/hgext/transplant.py
> --- a/hgext/transplant.py
> +++ b/hgext/transplant.py
> @@ -666,9 +666,9 @@
> Transplanted changesets in set, or all transplanted changesets.
> """
> if x:
> - s = revset.getset(repo, subset, x)
> + s = revset.getset(repo, subset, x)
> else:
> - s = subset
> + s = subset
> return [r for r in s if repo[r].extra().get('transplant_source')]
>
> def kwtransplanted(repo, ctx, **args):
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4499,7 +4499,7 @@
> try:
> # set phase
> if not revs:
> - raise util.Abort(_('empty revision set'))
> + raise util.Abort(_('empty revision set'))
> nodes = [repo[r].node() for r in revs]
> olddata = repo._phasecache.getphaserevs(repo)[:]
> phases.advanceboundary(repo, targetphase, nodes)
> @@ -5442,7 +5442,7 @@
> # current bookmark not in parent ctx marks
> pass
> for m in marks:
> - ui.write(' ' + m, label='log.bookmark')
> + ui.write(' ' + m, label='log.bookmark')
> ui.write('\n', label='log.bookmark')
>
> st = list(repo.status(unknown=True))[:6]
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -169,7 +169,7 @@
> try: # usually it is in the form (errno, strerror)
> reason = inst.reason.args[1]
> except (AttributeError, IndexError):
> - # it might be anything, for example a string
> + # it might be anything, for example a string
> reason = inst.reason
> ui.warn(_("abort: error: %s\n") % reason)
> elif util.safehasattr(inst, "args") and inst.args[0] == errno.EPIPE:
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -272,7 +272,7 @@
> return bookmarks.readcurrent(self)
>
> def _writebookmarks(self, marks):
> - bookmarks.write(self)
> + bookmarks.write(self)
>
> def bookmarkheads(self, bookmark):
> name = bookmark.split('@', 1)[0]
> diff --git a/mercurial/patch.py b/mercurial/patch.py
> --- a/mercurial/patch.py
> +++ b/mercurial/patch.py
> @@ -634,7 +634,7 @@
> if self.mode is None:
> self.mode = (False, False)
> if self.missing:
> - self.ui.warn(_("unable to find '%s' for patching\n") % self.fname)
> + self.ui.warn(_("unable to find '%s' for patching\n") % self.fname)
>
> self.hash = {}
> self.dirty = 0
> @@ -1630,9 +1630,9 @@
> if opts.git or opts.upgrade:
> copy = copies.pathcopies(ctx1, ctx2)
>
> - difffn = (lambda opts, losedata:
> - trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
> - copy, getfilectx, opts, losedata, prefix))
> + def difffn(opts, losedata):
> + return trydiff(repo, revs, ctx1, ctx2, modified, added, removed,
> + copy, getfilectx, opts, losedata, prefix)
> if opts.upgrade and not opts.git:
> try:
> def losedata(fn):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list