changeset 134:1b47146a4a2c 1.4

style: fix long lines
author Matt Mackall <mpm@selenic.com>
date Tue, 30 Sep 2014 12:48:04 -0500
parents b6f601ba7f3c
children f6b6e16531f8
files hglib/__init__.py hglib/client.py hglib/context.py hglib/util.py setup.py tests/common.py tests/test-annotate.py tests/test-branch.py tests/test-commit.py tests/test-diff.py tests/test-grep.py tests/test-hglib.py tests/test-hidden.py tests/test-log.py tests/test-resolve.py tests/test-update.py
diffstat 16 files changed, 290 insertions(+), 233 deletions(-) [+]
line wrap: on
line diff
--- a/hglib/__init__.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/hglib/__init__.py	Tue Sep 30 12:48:04 2014 -0500
@@ -3,9 +3,10 @@
 HGPATH = 'hg'
 
 def open(path=None, encoding=None, configs=None):
-    ''' starts a cmdserver for the given path (or for a repository found in the
-    cwd). HGENCODING is set to the given encoding. configs is a list of key, value,
-    similar to those passed to hg --config. '''
+    '''starts a cmdserver for the given path (or for a repository found
+    in the cwd). HGENCODING is set to the given encoding. configs is a
+    list of key, value, similar to those passed to hg --config.
+    '''
     return client.hgclient(path, encoding, configs)
 
 def init(dest=None, ssh=None, remotecmd=None, insecure=False,
--- a/hglib/client.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/hglib/client.py	Tue Sep 30 12:48:04 2014 -0500
@@ -78,8 +78,9 @@
 
         self.capabilities = msg[0][len('capabilities: '):]
         if not self.capabilities:
-            raise error.ResponseError("bad hello message: expected 'capabilities: '"
-                                      ", got %r" % msg[0])
+            raise error.ResponseError(
+                "bad hello message: expected 'capabilities: '"
+                ", got %r" % msg[0])
 
         self.capabilities = set(self.capabilities.split())
 
@@ -103,14 +104,16 @@
 
     @staticmethod
     def _parserevs(splitted):
-        ''' splitted is a list of fields according to our rev.style, where each 6
-        fields compose one revision. '''
+        '''splitted is a list of fields according to our rev.style, where
+        each 6 fields compose one revision.
+        '''
         revs = []
         for rev in util.grouper(7, splitted):
             # truncate the timezone and convert to a local datetime
             posixtime = float(rev[6].split('.', 1)[0])
             dt = datetime.datetime.fromtimestamp(posixtime)
-            revs.append(revision(rev[0], rev[1], rev[2], rev[3], rev[4], rev[5], dt))
+            revs.append(revision(rev[0], rev[1], rev[2], rev[3],
+                                 rev[4], rev[5], dt))
         return revs
 
     def runcommand(self, args, inchannels, outchannels):
@@ -139,8 +142,8 @@
                 return struct.unpack(hgclient.retfmt, data)[0]
             # a channel that we don't know and can't ignore
             elif channel.isupper():
-                raise error.ResponseError("unexpected data on required channel '%s'"
-                                          % channel)
+                raise error.ResponseError(
+                    "unexpected data on required channel '%s'" % channel)
             # optional channel
             else:
                 pass
@@ -191,12 +194,11 @@
         return self
 
     def close(self):
-        """
-        Closes the command server instance and waits for it to exit, returns the
-        exit code.
+        """Closes the command server instance and waits for it to exit,
+        returns the exit code.
 
-        Attempting to call any function afterwards that needs to communicate with
-        the server will raise a ValueError.
+        Attempting to call any function afterwards that needs to
+        communicate with the server will raise a ValueError.
         """
         self.server.stdin.close()
         self.server.wait()
@@ -230,25 +232,27 @@
 
     def addremove(self, files=[], similarity=None, dryrun=False, include=None,
                   exclude=None):
-        """
-        Add all new files and remove all missing files from the repository.
+        """Add all new files and remove all missing files from the repository.
 
-        New files are ignored if they match any of the patterns in ".hgignore". As
-        with add, these changes take effect at the next commit.
+        New files are ignored if they match any of the patterns in
+        ".hgignore". As with add, these changes take effect at the
+        next commit.
 
         similarity - used to detect renamed files. With a parameter
-        greater than 0, this compares every removed file with every added file and
-        records those similar enough as renames. This option takes a percentage
-        between 0 (disabled) and 100 (files must be identical) as its parameter.
-        Detecting renamed files this way can be expensive. After using this
-        option, "hg status -C" can be used to check which files were identified as
-        moved or renamed.
+        greater than 0, this compares every removed file with every
+        added file and records those similar enough as renames. This
+        option takes a percentage between 0 (disabled) and 100 (files
+        must be identical) as its parameter. Detecting renamed files
+        this way can be expensive. After using this option, "hg status
+        -C" can be used to check which files were identified as moved
+        or renamed.
 
         dryrun - do no perform actions
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
 
         Return True if all files are successfully added.
+
         """
         if not isinstance(files, list):
             files = [files]
@@ -297,15 +301,15 @@
 
     def archive(self, dest, rev=None, nodecode=False, prefix=None, type=None,
                 subrepos=False, include=None, exclude=None):
-        """
-        Create an unversioned archive of a repository revision.
+        """Create an unversioned archive of a repository revision.
 
         The exact name of the destination archive or directory is given using a
         format string; see export for details.
 
-        Each member added to an archive file has a directory prefix prepended. Use
-        prefix to specify a format string for the prefix. The default is the
-        basename of the archive, with suffixes removed.
+        Each member added to an archive file has a directory prefix
+        prepended. Use prefix to specify a format string for the
+        prefix. The default is the basename of the archive, with
+        suffixes removed.
 
         dest - destination path
         rev - revision to distribute. The revision used is the parent of the
@@ -328,6 +332,7 @@
         subrepos - recurse into subrepositories
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         args = cmdbuilder('archive', dest, r=rev, no_decode=nodecode, p=prefix,
                           t=type, S=subrepos, I=include, X=exclude,
@@ -337,13 +342,12 @@
 
     def backout(self, rev, merge=False, parent=None, tool=None, message=None,
                 logfile=None, date=None, user=None):
-        """
-        Prepare a new changeset with the effect of rev undone in the current
+        """Prepare a new changeset with the effect of rev undone in the current
         working directory.
 
-        If rev is the parent of the working directory, then this new changeset is
-        committed automatically. Otherwise, hg needs to merge the changes and the
-        merged result is left uncommitted.
+        If rev is the parent of the working directory, then this new
+        changeset is committed automatically. Otherwise, hg needs to
+        merge the changes and the merged result is left uncommitted.
 
         rev - revision to backout
         merge - merge with old dirstate parent after backout
@@ -353,6 +357,7 @@
         logfile - read commit message from file
         date - record the specified date as commit date
         user - record the specified user as committer
+
         """
         if message and logfile:
             raise ValueError("cannot specify both a message and a logfile")
@@ -363,8 +368,8 @@
 
         self.rawcommand(args)
 
-    def bookmark(self, name, rev=None, force=False, delete=False, inactive=False,
-                 rename=None):
+    def bookmark(self, name, rev=None, force=False, delete=False,
+                 inactive=False, rename=None):
         """
         Set a bookmark on the working directory's parent revision or rev,
         with the given name.
@@ -404,18 +409,20 @@
         return bms, current
 
     def branch(self, name=None, clean=False, force=False):
-        """
-        When name isn't given, return the current branch name. Otherwise set the
-        working directory branch name (the branch will not exist in the repository
-        until the next commit). Standard practice recommends that primary
-        development take place on the 'default' branch.
+        """When name isn't given, return the current branch name. Otherwise
+        set the working directory branch name (the branch will not
+        exist in the repository until the next commit). Standard
+        practice recommends that primary development take place on the
+        'default' branch.
 
-        When clean is True, reset and return the working directory branch to that
-        of the parent of the working directory, negating a previous branch change.
+        When clean is True, reset and return the working directory
+        branch to that of the parent of the working directory,
+        negating a previous branch change.
 
         name - new branch name
         clean - reset branch name to parent branch name
         force - set branch name even if it shadows an existing branch
+
         """
         if name and clean:
             raise ValueError('cannot use both name and clean')
@@ -451,10 +458,10 @@
         return branches
 
     def bundle(self, file, destrepo=None, rev=[], branch=[], base=[], all=False,
-               force=False, type=None, ssh=None, remotecmd=None, insecure=False):
-        """
-        Generate a compressed changegroup file collecting changesets not known to
-        be in another repository.
+               force=False, type=None, ssh=None, remotecmd=None,
+               insecure=False):
+        """Generate a compressed changegroup file collecting changesets not
+        known to be in another repository.
 
         If destrepo isn't given, then hg assumes the destination will have all
         the nodes you specify with base. To create a bundle containing all
@@ -466,15 +473,17 @@
         branch - a specific branch you would like to bundle
         base - a base changeset assumed to be available at the destination
         all - bundle all changesets in the repository
-        type - bundle compression type to use, available compression methods are:
-        none, bzip2, and gzip (default: bzip2)
+        type - bundle compression type to use, available compression
+         methods are: none, bzip2, and gzip (default: bzip2)
 
         force - run even when the destrepo is unrelated
         ssh - specify ssh command to use
         remotecmd - specify hg command to run on the remote side
-        insecure - do not verify server certificate (ignoring web.cacerts config)
+        insecure - do not verify server certificate (ignoring
+         web.cacerts config)
 
         Return True if a bundle was created, False if no changes were found.
+
         """
         args = cmdbuilder('bundle', file, destrepo, f=force, r=rev, b=branch,
                           base=base, a=all, t=type, e=ssh, remotecmd=remotecmd,
@@ -486,18 +495,19 @@
         return bool(eh)
 
     def cat(self, files, rev=None, output=None):
-        """
-        Return a string containing the specified files as they were at the
+        """Return a string containing the specified files as they were at the
         given revision. If no revision is given, the parent of the working
         directory is used, or tip if no revision is checked out.
 
         If output is given, writes the contents to the specified file.
-        The name of the file is given using a format string. The formatting rules
-        are the same as for the export command, with the following additions:
+        The name of the file is given using a format string. The
+        formatting rules are the same as for the export command, with
+        the following additions:
 
         "%s"  basename of file being printed
         "%d"  dirname of file being printed, or '.' if in repository root
         "%p"  root-relative path name of file being printed
+
         """
         args = cmdbuilder('cat', r=rev, o=output, hidden=self.hidden, *files)
         out = self.rawcommand(args)
@@ -517,11 +527,13 @@
         updaterev - revision, tag or branch to check out
         revrange - include the specified changeset
         """
-        args = cmdbuilder('clone', source, dest, b=branch, u=updaterev, r=revrange)
+        args = cmdbuilder('clone', source, dest, b=branch,
+                          u=updaterev, r=revrange)
         self.rawcommand(args)
 
-    def commit(self, message=None, logfile=None, addremove=False, closebranch=False,
-               date=None, user=None, include=None, exclude=None):
+    def commit(self, message=None, logfile=None, addremove=False,
+               closebranch=False, date=None, user=None, include=None,
+               exclude=None):
         """
         Commit changes reported by status into the repository.
 
@@ -549,11 +561,12 @@
         return int(rev.split()[-1]), node
 
     def config(self, names=[], untrusted=False, showsource=False):
-        """
-        Return a list of (section, key, value) config settings from all hgrc files
+        """Return a list of (section, key, value) config settings from all
+        hgrc files
 
         When showsource is specified, return (source, section, key, value) where
         source is of the form filename:[line]
+
         """
         def splitline(s):
             k, value = s.rstrip().split('=', 1)
@@ -595,9 +608,9 @@
 
     def copy(self, source, dest, after=False, force=False, dryrun=False,
              include=None, exclude=None):
-        """
-        Mark dest as having copies of source files. If dest is a directory, copies
-        are put in that directory. If dest is a file, then source must be a string.
+        """Mark dest as having copies of source files. If dest is a
+        directory, copies are put in that directory. If dest is a
+        file, then source must be a string.
 
         Returns True on success, False if errors are encountered.
 
@@ -608,6 +621,7 @@
         dryrun - do not perform actions, just print output
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if not isinstance(source, list):
             source = [source]
@@ -622,9 +636,11 @@
         return bool(eh)
 
     def diff(self, files=[], revs=[], change=None, text=False,
-             git=False, nodates=False, showfunction=False, reverse=False,
-             ignoreallspace=False, ignorespacechange=False, ignoreblanklines=False,
-             unified=None, stat=False, subrepos=False, include=None, exclude=None):
+             git=False, nodates=False, showfunction=False,
+             reverse=False, ignoreallspace=False,
+             ignorespacechange=False, ignoreblanklines=False,
+             unified=None, stat=False, subrepos=False, include=None,
+             exclude=None):
         """
         Return differences between revisions for the specified files.
 
@@ -657,12 +673,11 @@
 
         return self.rawcommand(args)
 
-    def export(self, revs, output=None, switchparent=False, text=False, git=False,
-               nodates=False):
-        """
-        Return the header and diffs for one or more changesets. When output is
-        given, dumps to file. The name of the file is given using a format string.
-        The formatting rules are as follows:
+    def export(self, revs, output=None, switchparent=False,
+               text=False, git=False, nodates=False):
+        """Return the header and diffs for one or more changesets. When
+        output is given, dumps to file. The name of the file is given
+        using a format string. The formatting rules are as follows:
 
         "%%"  literal "%" character
         "%H"  changeset hash (40 hexadecimal digits)
@@ -679,6 +694,7 @@
         text - treat all files as text
         git - use git extended diff format
         nodates - omit dates from diff headers
+
         """
         if not isinstance(revs, list):
             revs = [revs]
@@ -692,9 +708,8 @@
             return out
 
     def forget(self, files, include=None, exclude=None):
-        """
-        Mark the specified files so they will no longer be tracked after the next
-        commit.
+        """Mark the specified files so they will no longer be tracked after
+        the next commit.
 
         This only removes files from the current branch, not from the entire
         project history, and it does not delete them from the working directory.
@@ -703,6 +718,7 @@
 
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if not isinstance(files, list):
             files = [files]
@@ -717,19 +733,19 @@
     def grep(self, pattern, files=[], all=False, text=False, follow=False,
              ignorecase=False, fileswithmatches=False, line=False, user=False,
              date=False, include=None, exclude=None):
-        """
-        Search for a pattern in specified files and revisions.
+        """Search for a pattern in specified files and revisions.
 
         This behaves differently than Unix grep. It only accepts Python/Perl
         regexps. It searches repository history, not the working directory.
         It always prints the revision number in which a match appears.
 
-        Yields (filename, revision, [line, [match status, [user, [date, [match]]]]])
-        per match depending on the given options.
+        Yields (filename, revision, [line, [match status, [user,
+        [date, [match]]]]]) per match depending on the given options.
 
         all - print all revisions that match
         text - treat all files as text
-        follow - follow changeset history, or file history across copies and renames
+        follow - follow changeset history, or file history across
+         copies and renames
         ignorecase - ignore case when matching
         fileswithmatches - return only filenames and revisions that match
         line - return line numbers in the result tuple
@@ -737,6 +753,7 @@
         date - return the date in the result tuple
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if not isinstance(files, list):
             files = [files]
@@ -769,17 +786,17 @@
         return util.grouper(fieldcount, out)
 
     def heads(self, rev=[], startrev=[], topological=False, closed=False):
-        """
-        Return a list of current repository heads or branch heads.
+        """Return a list of current repository heads or branch heads.
 
-        rev - return only branch heads on the branches associated with the specified
-        changesets.
+        rev - return only branch heads on the branches associated with
+        the specified changesets.
 
         startrev - return only heads which are descendants of the given revs.
         topological - named branch mechanics will be ignored and only changesets
         without children will be shown.
 
         closed - normal and closed branch heads.
+
         """
         if not isinstance(rev, list):
             rev = [rev]
@@ -798,14 +815,13 @@
 
     def identify(self, rev=None, source=None, num=False, id=False, branch=False,
                  tags=False, bookmarks=False):
-        """
-        Return a summary string identifying the repository state at rev using one or
-        two parent hash identifiers, followed by a "+" if the working directory has
-        uncommitted changes, the branch name (if not default), a list of tags, and
-        a list of bookmarks.
+        """Return a summary string identifying the repository state at rev
+        using one or two parent hash identifiers, followed by a "+" if
+        the working directory has uncommitted changes, the branch name
+        (if not default), a list of tags, and a list of bookmarks.
 
-        When rev is not given, return a summary string of the current state of the
-        repository.
+        When rev is not given, return a summary string of the current
+        state of the repository.
 
         Specifying source as a repository root or Mercurial bundle will cause
         lookup to operate on that repository/bundle.
@@ -815,22 +831,23 @@
         branch - show branch
         tags - show tags
         bookmarks - show bookmarks
+
         """
-        args = cmdbuilder('identify', source, r=rev, n=num, i=id, b=branch, t=tags,
-                          B=bookmarks, hidden=self.hidden)
+        args = cmdbuilder('identify', source, r=rev, n=num, i=id,
+                          b=branch, t=tags, B=bookmarks,
+                          hidden=self.hidden)
 
         return self.rawcommand(args)
 
     def import_(self, patches, strip=None, force=False, nocommit=False,
                 bypass=False, exact=False, importbranch=False, message=None,
                 date=None, user=None, similarity=None):
-        """
-        Import the specified patches which can be a list of file names or a
+        """Import the specified patches which can be a list of file names or a
         file-like object and commit them individually (unless nocommit is
         specified).
 
-        strip - directory strip option for patch. This has the same meaning as the
-        corresponding patch option (default: 1)
+        strip - directory strip option for patch. This has the same
+        meaning as the corresponding patch option (default: 1)
 
         force - skip check for outstanding uncommitted changes
         nocommit - don't commit, just update the working directory
@@ -841,6 +858,7 @@
         date - record the specified date as commit date
         user - record the specified user as committer
         similarity - guess renamed files by similarity (0<=s<=100)
+
         """
         if hasattr(patches, 'read') and hasattr(patches, 'readline'):
             patch = patches
@@ -868,17 +886,17 @@
     def incoming(self, revrange=None, path=None, force=False, newest=False,
                  bundle=None, bookmarks=False, branch=None, limit=None,
                  nomerges=False, subrepos=False):
-        """
-        Return new changesets found in the specified path or the default pull
+        """Return new changesets found in the specified path or the default pull
         location.
 
-        When bookmarks=True, return a list of (name, node) of incoming bookmarks.
+        When bookmarks=True, return a list of (name, node) of incoming
+        bookmarks.
 
         revrange - a remote changeset or list of changesets intended to be added
         force - run even if remote repository is unrelated
         newest - show newest record first
-        bundle - avoid downloading the changesets twice and store the bundles into
-        the specified file.
+        bundle - avoid downloading the changesets twice and store the
+         bundles into the specified file.
 
         bookmarks - compare bookmarks (this changes the return value)
         branch - a specific branch you would like to pull
@@ -888,12 +906,13 @@
         remotecmd - specify hg command to run on the remote side
         insecure- do not verify server certificate (ignoring web.cacerts config)
         subrepos - recurse into subrepositories
+
         """
-        args = cmdbuilder('incoming',
-                          path,
+        args = cmdbuilder('incoming', path,
                           template=templates.changeset, r=revrange,
                           f=force, n=newest, bundle=bundle,
-                          B=bookmarks, b=branch, l=limit, M=nomerges, S=subrepos)
+                          B=bookmarks, b=branch, l=limit, M=nomerges,
+                          S=subrepos)
 
         def eh(ret, out, err):
             if ret != 1:
@@ -913,12 +932,13 @@
             out = out.split('\0')[:-1]
             return self._parserevs(out)
 
-    def log(self, revrange=None, files=[], follow=False, followfirst=False,
-            date=None, copies=False, keyword=None, removed=False, onlymerges=False,
-            user=None, branch=None, prune=None, hidden=None, limit=None,
-            nomerges=False, include=None, exclude=None):
-        """
-        Return the revision history of the specified files or the entire project.
+    def log(self, revrange=None, files=[], follow=False,
+            followfirst=False, date=None, copies=False, keyword=None,
+            removed=False, onlymerges=False, user=None, branch=None,
+            prune=None, hidden=None, limit=None, nomerges=False,
+            include=None, exclude=None):
+        """Return the revision history of the specified files or the entire
+        project.
 
         File history is shown without following rename or copy history of files.
         Use follow with a filename to follow history across renames and copies.
@@ -926,11 +946,13 @@
         starting revision. followfirst only follows the first parent of merge
         revisions.
 
-        If revrange isn't specified, the default is "tip:0" unless follow is set,
-        in which case the working directory parent is used as the starting
-        revision.
+        If revrange isn't specified, the default is "tip:0" unless
+        follow is set, in which case the working directory parent is
+        used as the starting revision.
 
-        The returned changeset is a named tuple with the following string fields:
+        The returned changeset is a named tuple with the following
+        string fields:
+
             - rev
             - node
             - tags (space delimited)
@@ -938,7 +960,8 @@
             - author
             - desc
 
-        follow - follow changeset history, or file history across copies and renames
+        follow - follow changeset history, or file history across
+         copies and renames
         followfirst - only follow the first parent of merge changesets
         date - show revisions matching date spec
         copies - show copied files
@@ -953,6 +976,7 @@
         nomerges - do not show merges
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if hidden is None:
             hidden = self.hidden
@@ -969,14 +993,14 @@
         return self._parserevs(out)
 
     def manifest(self, rev=None, all=False):
-        """
-        Yields (nodeid, permission, executable, symlink, file path) tuples for
-        version controlled files for the given revision. If no revision is given,
-        the first parent of the working directory is used, or the null revision if
-        no revision is checked out.
+        """Yields (nodeid, permission, executable, symlink, file path) tuples
+        for version controlled files for the given revision. If no
+        revision is given, the first parent of the working directory
+        is used, or the null revision if no revision is checked out.
 
-        When all is True, all files from all revisions are yielded (just the name).
-        This includes deleted and renamed files.
+        When all is True, all files from all revisions are yielded
+        (just the name). This includes deleted and renamed files.
+
         """
         args = cmdbuilder('manifest', r=rev, all=all, debug=True,
                           hidden=self.hidden)
@@ -995,10 +1019,10 @@
                 yield (node, perm, executable, symlink, line[47:])
 
     def merge(self, rev=None, force=False, tool=None, cb=merge.handlers.abort):
-        """
-        Merge working directory with rev. If no revision is specified, the working
-        directory's parent is a head revision, and the current branch contains
-        exactly one other head, the other head is merged with by default.
+        """Merge working directory with rev. If no revision is specified, the
+        working directory's parent is a head revision, and the current
+        branch contains exactly one other head, the other head is
+        merged with by default.
 
         The current working directory is updated with all changes made in the
         requested revision since the last common predecessor revision.
@@ -1011,11 +1035,13 @@
         tool - can be used to specify the merge tool used for file merges. It
         overrides the HGMERGE environment variable and your configuration files.
 
-        cb - controls the behaviour when Mercurial prompts what to do with regard
-        to a specific file, e.g. when one parent modified a file and the other
-        removed it. It can be one of merge.handlers, or a function that gets a
-        single argument which are the contents of stdout. It should return one
-        of the expected choices (a single character).
+        cb - controls the behaviour when Mercurial prompts what to do
+        with regard to a specific file, e.g. when one parent modified
+        a file and the other removed it. It can be one of
+        merge.handlers, or a function that gets a single argument
+        which are the contents of stdout. It should return one of the
+        expected choices (a single character).
+
         """
         # we can't really use --preview since merge doesn't support --template
         args = cmdbuilder('merge', r=rev, f=force, t=tool)
@@ -1032,10 +1058,9 @@
 
     def move(self, source, dest, after=False, force=False, dryrun=False,
              include=None, exclude=None):
-        """
-        Mark dest as copies of source; mark source for deletion. If dest is a
-        directory, copies are put in that directory. If dest is a file, then source
-        must be a string.
+        """Mark dest as copies of source; mark source for deletion. If dest
+        is a directory, copies are put in that directory. If dest is a
+        file, then source must be a string.
 
         Returns True on success, False if errors are encountered.
 
@@ -1046,6 +1071,7 @@
         dryrun - do not perform actions, just print output
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if not isinstance(source, list):
             source = [source]
@@ -1062,23 +1088,22 @@
     def outgoing(self, revrange=None, path=None, force=False, newest=False,
                  bookmarks=False, branch=None, limit=None, nomerges=False,
                  subrepos=False):
-        """
-        Return changesets not found in the specified path or the default push
+        """Return changesets not found in the specified path or the default push
         location.
 
-        When bookmarks=True, return a list of (name, node) of bookmarks that will
-        be pushed.
+        When bookmarks=True, return a list of (name, node) of
+        bookmarks that will be pushed.
 
-        revrange - a (list of) changeset intended to be included in the destination
-        force - run even when the destination is unrelated
-        newest - show newest record first
-        branch - a specific branch you would like to push
-        limit - limit number of changes displayed
-        nomerges - do not show merges
-        ssh - specify ssh command to use
-        remotecmd - specify hg command to run on the remote side
-        insecure - do not verify server certificate (ignoring web.cacerts config)
-        subrepos - recurse into subrepositories
+        revrange - a (list of) changeset intended to be included in
+        the destination force - run even when the destination is
+        unrelated newest - show newest record first branch - a
+        specific branch you would like to push limit - limit number of
+        changes displayed nomerges - do not show merges ssh - specify
+        ssh command to use remotecmd - specify hg command to run on
+        the remote side insecure - do not verify server certificate
+        (ignoring web.cacerts config) subrepos - recurse into
+        subrepositories
+
         """
         args = cmdbuilder('outgoing',
                           path,
@@ -1105,11 +1130,12 @@
             return self._parserevs(out)
 
     def parents(self, rev=None, file=None):
-        """
-        Return the working directory's parent revisions. If rev is given, the
-        parent of that revision will be printed. If file is given, the revision
-        in which the file was last changed (before the working directory revision
-        or the revision specified by rev) is returned.
+        """Return the working directory's parent revisions. If rev is given,
+        the parent of that revision will be printed. If file is given,
+        the revision in which the file was last changed (before the
+        working directory revision or the revision specified by rev)
+        is returned.
+
         """
         args = cmdbuilder('parents', file, template=templates.changeset, r=rev,
                           hidden=self.hidden)
@@ -1142,15 +1168,15 @@
             out = self.rawcommand(args)
             return out.rstrip()
 
-    def pull(self, source=None, rev=None, update=False, force=False, bookmark=None,
-             branch=None, ssh=None, remotecmd=None, insecure=False, tool=None):
-        """
-        Pull changes from a remote repository.
+    def pull(self, source=None, rev=None, update=False, force=False,
+             bookmark=None, branch=None, ssh=None, remotecmd=None,
+             insecure=False, tool=None):
+        """Pull changes from a remote repository.
 
-        This finds all changes from the repository specified by source and adds
-        them to this repository. If source is omitted, the 'default' path will be
-        used. By default, this does not update the copy of the project in the
-        working directory.
+        This finds all changes from the repository specified by source
+        and adds them to this repository. If source is omitted, the
+        'default' path will be used. By default, this does not update
+        the copy of the project in the working directory.
 
         Returns True on success, False if update was given and there were
         unresolved files.
@@ -1162,11 +1188,14 @@
         branch - a (list of) specific branch you would like to pull
         ssh - specify ssh command to use
         remotecmd - specify hg command to run on the remote side
-        insecure - do not verify server certificate (ignoring web.cacerts config)
+        insecure - do not verify server certificate (ignoring
+         web.cacerts config)
         tool - specify merge tool for rebase
+
         """
-        args = cmdbuilder('pull', source, r=rev, u=update, f=force, B=bookmark,
-                          b=branch, e=ssh, remotecmd=remotecmd, insecure=insecure,
+        args = cmdbuilder('pull', source, r=rev, u=update, f=force,
+                          B=bookmark, b=branch, e=ssh,
+                          remotecmd=remotecmd, insecure=insecure,
                           t=tool)
 
         eh = util.reterrorhandler(args)
@@ -1176,29 +1205,30 @@
 
     def push(self, dest=None, rev=None, force=False, bookmark=None, branch=None,
              newbranch=False, ssh=None, remotecmd=None, insecure=False):
-        """
-        Push changesets from this repository to the specified destination.
+        """Push changesets from this repository to the specified destination.
 
         This operation is symmetrical to pull: it is identical to a pull in the
         destination repository from the current one.
 
         Returns True if push was successful, False if nothing to push.
 
-        rev - the (list of) specified revision and all its ancestors will be pushed
-        to the remote repository.
+        rev - the (list of) specified revision and all its ancestors
+        will be pushed to the remote repository.
 
         force - override the default behavior and push all changesets on all
         branches.
 
         bookmark - (list of) bookmark to push
         branch - a (list of) specific branch you would like to push
-        newbranch - allows push to create a new named branch that is not present at
-        the destination. This allows you to only create a new branch without
-        forcing other changes.
+        newbranch - allows push to create a new named branch that is
+         not present at the destination. This allows you to only create
+         a new branch without forcing other changes.
 
         ssh - specify ssh command to use
         remotecmd - specify hg command to run on the remote side
-        insecure - do not verify server certificate (ignoring web.cacerts config)
+        insecure - do not verify server certificate (ignoring
+         web.cacerts config)
+
         """
         args = cmdbuilder('push', dest, r=rev, f=force, B=bookmark, b=branch,
                           new_branch=newbranch, e=ssh, remotecmd=remotecmd,
@@ -1209,10 +1239,11 @@
 
         return bool(eh)
 
-    def remove(self, files, after=False, force=False, include=None, exclude=None):
-        """
-        Schedule the indicated files for removal from the repository. This only
-        removes files from the current branch, not from the entire project history.
+    def remove(self, files, after=False, force=False, include=None,
+               exclude=None):
+        """Schedule the indicated files for removal from the repository. This
+        only removes files from the current branch, not from the
+        entire project history.
 
         Returns True on success, False if any warnings encountered.
 
@@ -1220,6 +1251,7 @@
         force - remove (and delete) file even if added or modified
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
+
         """
         if not isinstance(files, list):
             files = [files]
@@ -1232,8 +1264,8 @@
 
         return bool(eh)
 
-    def resolve(self, file=[], all=False, listfiles=False, mark=False, unmark=False,
-                tool=None, include=None, exclude=None):
+    def resolve(self, file=[], all=False, listfiles=False, mark=False,
+                unmark=False, tool=None, include=None, exclude=None):
         """
         Redo merges or set/view the merge status of given files.
 
@@ -1265,20 +1297,21 @@
 
     def revert(self, files, rev=None, all=False, date=None, nobackup=False,
                dryrun=False, include=None, exclude=None):
-        """
-        With no revision specified, revert the specified files or directories to
-        the contents they had in the parent of the working directory. This
-        restores the contents of files to an unmodified state and unschedules
-        adds, removes, copies, and renames. If the working directory has two
-        parents, you must explicitly specify a revision.
+        """With no revision specified, revert the specified files or
+        directories to the contents they had in the parent of the
+        working directory. This restores the contents of files to an
+        unmodified state and unschedules adds, removes, copies, and
+        renames. If the working directory has two parents, you must
+        explicitly specify a revision.
 
-        Specifying rev or date will revert the given files or directories to their
-        states as of a specific revision. Because revert does not change the
-        working directory parents, this will cause these files to appear modified.
-        This can be helpful to "back out" some or all of an earlier change.
+        Specifying rev or date will revert the given files or
+        directories to their states as of a specific revision. Because
+        revert does not change the working directory parents, this
+        will cause these files to appear modified. This can be helpful
+        to "back out" some or all of an earlier change.
 
-        Modified files are saved with a .orig suffix before reverting. To disable
-        these backups, use nobackup.
+        Modified files are saved with a .orig suffix before reverting.
+        To disable these backups, use nobackup.
 
         Returns True on success.
 
@@ -1289,6 +1322,7 @@
         include - include names matching the given patterns
         exclude - exclude names matching the given patterns
         dryrun - do not perform actions, just print output
+
         """
         if not isinstance(files, list):
             files = [files]
@@ -1308,10 +1342,10 @@
         """
         return self.rawcommand(['root']).rstrip()
 
-    def status(self, rev=None, change=None, all=False, modified=False, added=False,
-               removed=False, deleted=False, clean=False, unknown=False,
-               ignored=False, copies=False, subrepos=False, include=None,
-               exclude=None):
+    def status(self, rev=None, change=None, all=False, modified=False,
+               added=False, removed=False, deleted=False, clean=False,
+               unknown=False, ignored=False, copies=False,
+               subrepos=False, include=None, exclude=None):
         """
         Return status of files in the repository as a list of (code, file path)
         where code can be:
@@ -1364,15 +1398,15 @@
 
     def tag(self, names, rev=None, message=None, force=False, local=False,
             remove=False, date=None, user=None):
-        """
-        Add one or more tags specified by names for the current or given revision.
+        """Add one or more tags specified by names for the current or given
+        revision.
 
         Changing an existing tag is normally disallowed; use force to override.
 
-        Tag commits are usually made at the head of a branch. If the parent of the
-        working directory is not a branch head, a CommandError will be raised.
-        force can be specified to force the tag commit to be based on a non-head
-        changeset.
+        Tag commits are usually made at the head of a branch. If the
+        parent of the working directory is not a branch head, a
+        CommandError will be raised. force can be specified to force
+        the tag commit to be based on a non-head changeset.
 
         local - make the tag local
         rev - revision to tag
@@ -1380,6 +1414,7 @@
         message - set commit message
         date - record the specified date as commit date
         user - record the specified user as committer
+
         """
         if not isinstance(names, list):
             names = [names]
@@ -1425,7 +1460,8 @@
         if not isinstance(revs, (list, tuple)):
             revs = [revs]
         args = util.cmdbuilder('phase', secret=secret, draft=draft,
-                               public=public, force=force, hidden=self.hidden, *revs)
+                               public=public, force=force,
+                               hidden=self.hidden, *revs)
         out = self.rawcommand(args)
         if draft or public or secret:
             return
@@ -1557,9 +1593,9 @@
 
     @property
     def version(self):
-        """
-        Return hg version that runs the command server as a 4 fielded tuple: major,
-        minor, micro and local build info. e.g. (1, 9, 1, '+4-3095db9f5c2c')
+        """Return hg version that runs the command server as a 4 fielded
+        tuple: major, minor, micro and local build info. e.g. (1, 9,
+        1, '+4-3095db9f5c2c')
         """
         if self._version is None:
             v = self.rawcommand(cmdbuilder('version', q=True))
--- a/hglib/context.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/hglib/context.py	Tue Sep 30 12:48:04 2014 -0500
@@ -1,7 +1,8 @@
 from hglib.error import CommandError
 import client, util, templates
 
-_nullcset = ['-1', '000000000000000000000000000000000000000', '', '', '', '', '']
+_nullcset = ['-1', '000000000000000000000000000000000000000', '', '',
+             '', '', '']
 
 class changectx(object):
     """A changecontext object makes access to data related to a particular
--- a/hglib/util.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/hglib/util.py	Tue Sep 30 12:48:04 2014 -0500
@@ -103,10 +103,10 @@
     return cmd
 
 class reterrorhandler(object):
-    """
-    This class is meant to be used with rawcommand() error handler argument.
-    It remembers the return value the command returned if it's one of allowed
-    values, which is only 1 if none are given. Otherwise it raises a CommandError.
+    """This class is meant to be used with rawcommand() error handler
+    argument. It remembers the return value the command returned if
+    it's one of allowed values, which is only 1 if none are given.
+    Otherwise it raises a CommandError.
 
     >>> e = reterrorhandler('')
     >>> bool(e)
@@ -115,6 +115,7 @@
     'a'
     >>> bool(e)
     False
+
     """
     def __init__(self, args, allowed=None):
         self.args = args
--- a/setup.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/setup.py	Tue Sep 30 12:48:04 2014 -0500
@@ -34,6 +34,7 @@
     author_email='idankk86@gmail.com',
     url='http://selenic.com/repo/python-hglib',
     description='Mercurial Python library',
-    long_description=open(os.path.join(os.path.dirname(__file__), 'README')).read(),
+    long_description=open(os.path.join(os.path.dirname(__file__),
+                                       'README')).read(),
     license='MIT',
     packages=['hglib'])
--- a/tests/common.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/common.py	Tue Sep 30 12:48:04 2014 -0500
@@ -20,7 +20,8 @@
         self.clients = []
         self._oldopen = hglib.client.hgclient.open
         # hglib.open = resultappender(self.clients)(hglib.open)
-        hglib.client.hgclient.open = resultappender(self.clients)(hglib.client.hgclient.open)
+        c = hglib.client.hgclient
+        c.open = resultappender(self.clients)(c.open)
 
         os.mkdir(self._testtmp)
         os.chdir(self._testtmp)
@@ -29,8 +30,8 @@
         self.client = hglib.open()
 
     def tearDown(self):
-        # on Windows we cannot rmtree before closing all instances because of used
-        # files
+        # on Windows we cannot rmtree before closing all instances
+        # because of used files
         hglib.client.hgclient.open = self._oldopen
         for client in self.clients:
             if client.server is not None:
--- a/tests/test-annotate.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-annotate.py	Tue Sep 30 12:48:04 2014 -0500
@@ -7,9 +7,12 @@
         self.append('a', 'a\n')
         rev, node1 = self.client.commit('second')
 
-        self.assertEquals(list(self.client.annotate('a')), [('0', 'a'), ('1', 'a')])
-        self.assertEquals(list(self.client.annotate('a', user=True, file=True,
-                          number=True, changeset=True, line=True, verbose=True)),
+        self.assertEquals(list(self.client.annotate('a')), [('0',
+                                                             'a'), ('1', 'a')])
+        self.assertEquals(list(
+            self.client.annotate(
+                'a', user=True, file=True,
+                number=True, changeset=True, line=True, verbose=True)),
                           [('test 0 %s a:1' % node0[:12], 'a'),
                            ('test 1 %s a:2' % node1[:12], 'a')])
 
--- a/tests/test-branch.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-branch.py	Tue Sep 30 12:48:04 2014 -0500
@@ -29,7 +29,8 @@
         self.client.branch('foo')
         self.append('a', 'a')
         self.client.commit('second')
-        self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
+        self.assertRaises(hglib.error.CommandError,
+                          self.client.branch, 'default')
 
     def test_force(self):
         self.append('a', 'a')
@@ -38,5 +39,6 @@
         self.append('a', 'a')
         self.client.commit('second')
 
-        self.assertRaises(hglib.error.CommandError, self.client.branch, 'default')
+        self.assertRaises(hglib.error.CommandError,
+                          self.client.branch, 'default')
         self.assertEquals(self.client.branch('default', force=True), 'default')
--- a/tests/test-commit.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-commit.py	Tue Sep 30 12:48:04 2014 -0500
@@ -9,7 +9,8 @@
 
     def test_no_user(self):
         self.append('a', 'a')
-        self.assertRaises(hglib.error.CommandError, self.client.commit, 'first', user='')
+        self.assertRaises(hglib.error.CommandError,
+                          self.client.commit, 'first', user='')
 
     def test_close_branch(self):
         self.append('a', 'a')
@@ -24,7 +25,8 @@
                           [(rev0.branch, int(rev0.rev), rev0.node[:12])])
 
         self.assertEquals(self.client.branches(closed=True),
-                          [(revclose.branch, int(revclose.rev), revclose.node[:12]),
+                          [(revclose.branch, int(revclose.rev),
+                            revclose.node[:12]),
                            (rev0.branch, int(rev0.rev), rev0.node[:12])])
 
     def test_message_logfile(self):
--- a/tests/test-diff.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-diff.py	Tue Sep 30 12:48:04 2014 -0500
@@ -37,7 +37,8 @@
  a
 +a
 """ % (node0[:12], node1[:12])
-        self.assertEquals(diff4, self.client.diff(revs=[rev0, rev1], nodates=True))
+        self.assertEquals(diff4, self.client.diff(revs=[rev0, rev1],
+                                                  nodates=True))
 
     def test_basic_plain(self):
         open('.hg/hgrc', 'a').write('[defaults]\ndiff=--git\n')
--- a/tests/test-grep.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-grep.py	Tue Sep 30 12:48:04 2014 -0500
@@ -34,5 +34,6 @@
 
         self.assertEquals([('a', '0', '1', '+', 'test'),
                            ('b', '0', '1', '+', 'test')],
-                          list(self.client.grep('a', all=True, user=True, line=True,
+                          list(self.client.grep('a', all=True, user=True,
+                                                line=True,
                                                 fileswithmatches=True)))
--- a/tests/test-hglib.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-hglib.py	Tue Sep 30 12:48:04 2014 -0500
@@ -5,9 +5,8 @@
         pass
 
     def test_close_fds(self):
-        """
-        A weird Python bug that has something to do to inherited file descriptors,
-        see http://bugs.python.org/issue12786
+        """A weird Python bug that has something to do to inherited file
+        descriptors, see http://bugs.python.org/issue12786
         """
         common.basetest.setUp(self)
         client2 = hglib.open()
--- a/tests/test-hidden.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-hidden.py	Tue Sep 30 12:48:04 2014 -0500
@@ -18,7 +18,9 @@
     def setUp(self):
         #create an extension which only activates obsolete
         super(test_obsolete_baselib, self).setUp()
-        self.append('.hg/obs.py',"""import mercurial.obsolete\nmercurial.obsolete._enabled = True""")
+        self.append('.hg/obs.py',
+                    "import mercurial.obsolete\n"
+                    "mercurial.obsolete._enabled = True")
         self.append('.hg/hgrc','\n[extensions]\nobs=.hg/obs.py')
 
 class test_obsolete_client(test_obsolete_baselib):
--- a/tests/test-log.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-log.py	Tue Sep 30 12:48:04 2014 -0500
@@ -20,7 +20,10 @@
         self.assertEquals(self.client.log(), self.client.log(hidden=True))
 
     # def test_errors(self):
-    #     self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'foo')
+    #     self.assertRaisesRegexp(CommandError, 'abort: unknown revision',
+    #                             self.client.log, 'foo')
     #     self.append('a', 'a')
     #     self.client.commit('first', addremove=True)
-    #     self.assertRaisesRegexp(CommandError, 'abort: unknown revision', self.client.log, 'bar')
+    #     self.assertRaisesRegexp(CommandError,
+    #                             'abort: unknown revision',
+    #                             self.client.log, 'bar')
--- a/tests/test-resolve.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-resolve.py	Tue Sep 30 12:48:04 2014 -0500
@@ -18,8 +18,10 @@
         self.append('b', 'a')
         rev, self.node3 = self.client.commit('third')
 
-        self.assertRaises(hglib.error.CommandError, self.client.merge, self.node1)
-        self.assertRaises(hglib.error.CommandError, self.client.resolve, all=True)
+        self.assertRaises(hglib.error.CommandError, self.client.merge,
+                          self.node1)
+        self.assertRaises(hglib.error.CommandError,
+                          self.client.resolve, all=True)
 
         self.assertEquals([('U', 'a'), ('U', 'b')],
                           self.client.resolve(listfiles=True))
--- a/tests/test-update.py	Tue Sep 30 11:23:15 2014 -0500
+++ b/tests/test-update.py	Tue Sep 30 12:48:04 2014 -0500
@@ -58,7 +58,8 @@
         self.assertEquals(self.client.parents()[0].node, node2)
 
     def test_check_clean(self):
-        self.assertRaises(ValueError, self.client.update, clean=True, check=True)
+        self.assertRaises(ValueError, self.client.update, clean=True,
+                          check=True)
 
     def test_clean(self):
         old = open('a').read()