changeset 25:5b6010df7f43 0.12

Trailing whitespace removal
author Christian Boos <cboos@edgewall.org>
date Thu, 06 Feb 2014 19:27:21 +0100
parents 2706330d90cb
children 546d3f11ac7a 659346a98de7
files setup.py tracext/hg/backend.py
diffstat 2 files changed, 62 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Mon Sep 17 20:46:41 2012 +0200
+++ b/setup.py	Thu Feb 06 19:27:21 2014 +0100
@@ -32,7 +32,7 @@
 
 except ImportError:
     pass
-    
+
 TracMercurial = 'http://trac.edgewall.org/wiki/TracMercurial'
 
 setup(name='TracMercurial',
--- a/tracext/hg/backend.py	Mon Sep 17 20:46:41 2012 +0200
+++ b/tracext/hg/backend.py	Thu Feb 06 19:27:21 2014 +0100
@@ -41,7 +41,7 @@
 # -- plugin i18n
 
 gettext, _, tag_, N_, add_domain = \
-    domain_functions('tracmercurial', 
+    domain_functions('tracmercurial',
                      ('gettext', '_', 'tag_', 'N_', 'add_domain'))
 
 # -- Using internal Mercurial API, see:
@@ -57,7 +57,7 @@
     # before loading mercurial modules, and desactivate it afterwards.
     #
     # See http://www.selenic.com/mercurial/bts/issue605
-    
+
     try:
         from mercurial import demandimport
         demandimport.enable();
@@ -75,7 +75,7 @@
     from mercurial.extensions import loadall
     from mercurial.error import RepoLookupError
 
-    # Note: due to the nature of demandimport, there will be no actual 
+    # Note: due to the nature of demandimport, there will be no actual
     # import error until those symbols get accessed, so here we go:
     for sym in ("filectx ui hex short nullid pathto "
                 "cachefunc loadall".split()):
@@ -96,7 +96,7 @@
     # Force local encoding to be non-lossy (#7217)
     os.environ['HGENCODING'] = 'utf-8'
     encoding.tolocal = str
-    
+
     if demandimport:
         demandimport.disable()
 
@@ -108,7 +108,7 @@
     else:
         from mercurial.scmutil import match
 
-    
+
 except ImportError, e:
     hg_import_error = e
     ui = object
@@ -130,7 +130,7 @@
              given to `check`, which can accept it as valid or not.
     """
     s = u
-    if isinstance(u, unicode): 
+    if isinstance(u, unicode):
         for enc in encodings:
             try:
                 s = u.encode(enc)
@@ -143,14 +143,14 @@
     if check(s):
         return s
 
-        
+
 class trac_ui(ui):
     # Note: will be dropped in 0.13, see MercurialConnector._setup_ui
     def __init__(self, *args, **kwargs):
         ui.__init__(self, *args)
         self.setconfig('ui', 'interactive', 'off')
         self.log = kwargs.get('log', args and args[0].log or None)
-        
+
     def write(self, *args, **opts):
         for a in args:
             self.log.info('(mercurial status) %s', a)
@@ -162,7 +162,7 @@
     def plain(self, *args, **kw):
         return False # so that '[hg] hgrc' file can specify [ui] options
 
-    def interactive(self): 
+    def interactive(self):
         return False
 
     def readline(self):
@@ -179,33 +179,33 @@
         return (name.startswith('hg-') and
                 name[3:] in ('Parents', 'Children', 'Tags', 'Branch') and
                 mode == 'revprop') and 4 or 0
-    
+
     def render_property(self, name, mode, context, props):
-        return RenderedProperty(name=gettext(name[3:] + ':'), 
+        return RenderedProperty(name=gettext(name[3:] + ':'),
                 name_attributes=[("class", "property")],
                 content=self._render_property(name, mode, context, props))
 
     def _render_property(self, name, mode, context, props):
         repos, revs = props[name]
-        
+
         if name in ('hg-Parents', 'hg-Children'):
             label = repos.display_rev
         else:
             label = lambda rev: rev
-        
+
         def link(rev):
             chgset = repos.get_changeset(rev)
             return tag.a(label(rev), class_="changeset",
                          title=shorten_line(chgset.message),
                          href=context.href.changeset(rev, repos.reponame))
-        
+
         if name == 'hg-Parents' and len(revs) == 2: # merge
             new = context.resource.id
             parent_links = [
                     (link(rev), ' (',
                      tag.a('diff', title=_("Diff against this parent "
                            "(show the changes merged from the other parents)"),
-                           href=context.href.changeset(new, repos.reponame, 
+                           href=context.href.changeset(new, repos.reponame,
                                                        old=rev)), ')')
                            for rev in revs]
             return tag([(parent, ', ') for parent in parent_links[:-1]],
@@ -214,11 +214,11 @@
                                      "the changes displayed below correspond "
                                      "to the merge itself.",
                                      merge=tag.strong('merge')),
-                                class_='hint'), tag.br(), 
-                       # TODO: only keep chunks present in both parents 
+                                class_='hint'), tag.br(),
+                       # TODO: only keep chunks present in both parents
                        #       (conflicts) or in none (extra changes)
                        # tag.span('No changes means the merge was clean.',
-                       #         class_='hint'), tag.br(), 
+                       #         class_='hint'), tag.br(),
                        tag.span(tag_("Use the %(diff)s links above to see all "
                                      "the changes relative to each parent.",
                                      diff=tag.tt('(diff)')),
@@ -234,7 +234,7 @@
     def match_property(self, name, mode):
        return name in ('hg-transplant_source', 'hg-convert_revision') and \
            mode == 'revprop' and 4 or 0
-    
+
     def render_property(self, name, mode, context, props):
         repos, value = props[name]
         if name == 'hg-transplant_source':
@@ -249,7 +249,7 @@
                              title=_("no such changeset"), rel="nofollow")
             return RenderedProperty(name=_("Transplant:"), content=link,
                                     name_attributes=[("class", "property")])
-        
+
         elif name == 'hg-convert_revision':
             text = repos.to_u(value)
             if value.startswith('svn:'):
@@ -274,11 +274,11 @@
 
     def match_property(self, name, mode):
        return name.startswith('hg-') and mode == 'revprop' and 1 or 0
-    
+
     def render_property(self, name, mode, context, props):
-        return RenderedProperty(name=name[3:] + ':', 
+        return RenderedProperty(name=name[3:] + ':',
                                 name_attributes=[("class", "property")],
-                                content=self._render_property(name, mode, 
+                                content=self._render_property(name, mode,
                                                               context, props))
 
     def _render_property(self, name, mode, context, props):
@@ -338,7 +338,7 @@
                 self._version = version()
             # development version assumed to be always the ''newest'' one,
             # i.e. old development version won't be supported
-            self._version_info = (999, 0, 0) 
+            self._version_info = (999, 0, 0)
             m = re.match(r'(\d+)\.(\d+)(?:\.(\d+))?', self._version or '')
             if m:
                 self._version_info = tuple([int(n or 0) for n in m.groups()])
@@ -348,7 +348,7 @@
         #
         #   ui = baseui.copy() # there's no longer a parent/child concept
         #   ui.setconfig('ui', 'interactive', 'off')
-        # 
+        #
         self.ui = trac_ui(log=self.log)
 
         # (code below adapted from mercurial.dispatch._dispatch)
@@ -362,7 +362,7 @@
                 self.ui.check_trusted = False
                 self.ui.readconfig(hgrc_path)
             except IOError, e:
-                self.log.warn("'[hg] hgrc' file (%s) can't be read: %s", 
+                self.log.warn("'[hg] hgrc' file (%s) can't be read: %s",
                               hgrc_path, e)
 
         extensions.loadall(self.ui)
@@ -383,7 +383,7 @@
             yield 'Mercurial', self._version
 
     # IRepositoryConnector methods
-    
+
     def get_supported_types(self):
         """Support for `repository_type = hg`"""
         if hg_import_error:
@@ -401,7 +401,7 @@
         return repos
 
     # IWikiSyntaxProvider methods
-    
+
     def get_wiki_syntax(self):
         yield (r'!?(?P<hgrev>[0-9a-f]{12,40})(?P<hgpath>/\S+\b)?',
                lambda formatter, label, match:
@@ -457,7 +457,7 @@
 
 
 ### Version Control API
-    
+
 class MercurialRepository(Repository):
     """Repository implementation based on the mercurial API.
 
@@ -516,7 +516,7 @@
         fsencoding = [sys.getfilesystemencoding() or 'utf-8'] + encoding
         str_path = checked_encode(path, fsencoding, os.path.exists)
         if str_path is None:
-            raise TracError(_("Repository path '%(path)s' does not exist.", 
+            raise TracError(_("Repository path '%(path)s' does not exist.",
                               path=path))
         try:
             self.repo = hg.repository(ui=self.ui, path=str_path)
@@ -617,7 +617,7 @@
             else:
                 return ''
         # branches
-        for ctx, b in sorted(branches.items(), reverse=True, 
+        for ctx, b in sorted(branches.items(), reverse=True,
                              key=lambda (ctx, b): ctx.rev()):
             yield ('branches', b + taginfo(ctx), '/', self._display(ctx))
         # heads
@@ -634,7 +634,7 @@
             except (KeyError, RepoLookupError):
                 pass
         # closed branches
-        for ctx, b in sorted(closed_branches.items(), reverse=True, 
+        for ctx, b in sorted(closed_branches.items(), reverse=True,
                              key=lambda (ctx, b): ctx.rev()):
             yield ('closed branches', b + taginfo(ctx), '/', self._display(ctx))
 
@@ -648,10 +648,10 @@
                 return url
             return url + '#' + self.to_u(branch) # URL for cloning that branch
 
-            # Note: link to matching location in Mercurial's file browser 
+            # Note: link to matching location in Mercurial's file browser
             #rev = rev is not None and short(n) or 'tip'
             #return '/'.join([url, 'file', rev, path])
-  
+
     def get_changeset(self, rev):
         return MercurialChangeset(self, self.changectx(rev))
 
@@ -663,7 +663,7 @@
 
         FIXME: this can only be handled correctly and efficiently by
         using the db repository cache.
-        
+
         The code below is only an heuristic, and doesn't work in the
         general case. E.g. look at the mercurial repository timeline
         for 2006-10-18, you need to give ''38'' daysback in order to
@@ -696,7 +696,7 @@
                     seeds.append(p)
 
     def get_node(self, path, rev=None):
-        return MercurialNode(self, self.normalize_path(path), 
+        return MercurialNode(self, self.normalize_path(path),
                              self.changectx(rev))
 
     def get_oldest_rev(self):
@@ -704,12 +704,12 @@
 
     def get_youngest_rev(self):
         return self.changectx().hex()
-    
+
     def previous_rev(self, rev, path=''): # FIXME: path ignored for now
         for p in self.changectx(rev).parents():
             if p:
                 return p.hex() # always follow first parent
-    
+
     def next_rev(self, rev, path=''):
         ctx = self.changectx(rev)
         if path: # might be a file
@@ -724,7 +724,7 @@
         # it might be a directory (not supported for now) FIXME
         for c in ctx.children():
             return c.hex() # always follow first child
-   
+
     def rev_older_than(self, rev1, rev2):
         # FIXME use == and ancestors?
         return self.short_rev(rev1) < self.short_rev(rev2)
@@ -735,7 +735,7 @@
     def get_changes(self, old_path, old_rev, new_path, new_rev,
                     ignore_ancestry=1):
         """Generates changes corresponding to generalized diffs.
-        
+
         Generator that yields change tuples (old_node, new_node, kind,
         change) for each node change between the two arbitrary
         (path,rev) pairs.
@@ -758,7 +758,7 @@
         # Correct change info from changelog(revlog)
         # Finding changes between two revs requires tracking back
         # several routes.
-                              
+
         if new_node.isdir:
             # TODO: Should we follow rename and copy?
             # As temporary workaround, simply compare entry names.
@@ -796,7 +796,7 @@
             if old_node.manifest[old_node.str_path] != \
                    new_node.manifest[new_node.str_path]:
                 yield(old_node, new_node, Node.FILE, Changeset.EDIT)
-            
+
 
 class MercurialNode(Node):
     """A path in the repository, at a given revision.
@@ -808,10 +808,10 @@
     than for files, except when created as a `subnode()` of an
     existing MercurialNode.
     """
-    
+
     filectx = dirnode = None
 
-    def __init__(self, repos, path, changectx, 
+    def __init__(self, repos, path, changectx,
                  manifest=None, dirctx=None, str_entry=None):
         """
         :param repos: the `MercurialRepository`
@@ -839,7 +839,7 @@
             str_path = str_entry
         else:
             # Fast path: check for existing file
-            str_path = checked_encode(path, repos.encoding, 
+            str_path = checked_encode(path, repos.encoding,
                                       lambda s: s in self.manifest)
             if str_path is None:
                 # Slow path: this might be a directory node
@@ -908,9 +908,9 @@
 
     def find_dirctx(self, max_rev, str_dirnames, str_entries):
         """Find most recent modification for each given directory path.
-        
+
         :param max_rev: find no revision more recent than this one
-        :param str_dirnames: directory paths to consider 
+        :param str_dirnames: directory paths to consider
                              (as `str` ending with '/')
         :param str_entries: optionally maps directories to their file content
 
@@ -928,7 +928,7 @@
            changelog and detect the first occurrence of a change in
            each directory; this is much faster but can still be slow
            if some folders are only modified in the distant past
-           
+
         It is possible to combine both approach, and this can yield
         excellent results in some cases (e.g. browsing the Linux repos
         @ 118733 takes several minutes with the first approach, 11s
@@ -973,8 +973,8 @@
                         str_dirnames.remove(str_dir)
                         if not str_dirnames:
                             return str_dirctxs
-                        
-                
+
+
     def subnode(self, str_path, subctx=None):
         """Return a node with the same revision information but for
         another path
@@ -992,7 +992,7 @@
 
     def read(self, size=None):
         if self.isdir:
-            return TracError(_("Can't read from directory %(path)s", 
+            return TracError(_("Can't read from directory %(path)s",
                                path=self.path))
         if self.data is None:
             self.data = self.filectx.data()
@@ -1006,7 +1006,7 @@
     def get_entries(self):
         if self.isfile:
             return
-       
+
         # dirnames are entries which are sub-directories
         str_entries = {}
         str_dirnames = []
@@ -1032,7 +1032,7 @@
 
         # pre-computing the changectx for the last change in each sub-directory
         if str_dirnames:
-            dirctxs = self.find_dirctx(self.created_rev, str_dirnames, 
+            dirctxs = self.find_dirctx(self.created_rev, str_dirnames,
                                        str_entries)
         else:
             dirctxs = {}
@@ -1093,7 +1093,7 @@
         get = cachefunc(changefn)
         if self.isfile:
             fncache = {}
-        chgiter, matchfn = cmdutil.walkchangerevs(self.repos.ui, repo, pats, 
+        chgiter, matchfn = cmdutil.walkchangerevs(self.repos.ui, repo, pats,
                                                   get, opts)
         # keep one lookahead entry so that we can detect renames
         path = self.path
@@ -1125,7 +1125,7 @@
             for fc, line in self.filectx.annotate(follow=True):
                 annotations.append(fc.rev() or '0')
         return annotations
-        
+
     def get_properties(self):
         if self.isfile and 'x' in self.manifest.flags(self.str_path):
             return {'exe': '*'}
@@ -1156,7 +1156,7 @@
     files changes are obtained by comparing the current manifest to
     the parent manifest(s).
     """
-    
+
     def __init__(self, repos, ctx):
         self.repos = repos
         self.ctx = ctx
@@ -1178,7 +1178,7 @@
         properties = {}
         parents = self.ctx.parents()
         if len(parents) > 1:
-            properties['hg-Parents'] = (self.repos, 
+            properties['hg-Parents'] = (self.repos,
                                         [p.hex() for p in parents if p])
         children = self.ctx.children()
         if len(children) > 1:
@@ -1188,7 +1188,7 @@
             properties['hg-Branch'] = (self.repos, [self.branch])
         tags = self.ctx.tags()
         if len(tags):
-            properties['hg-Tags'] = (self.repos, 
+            properties['hg-Tags'] = (self.repos,
                                      [self.repos.to_u(t) for t in tags])
         for k, v in self.ctx.extra().iteritems():
             if k != 'branch':
@@ -1206,7 +1206,7 @@
         changes = []
         for str_file in self.ctx.files(): # added, edited and deleted files
             f = u(str_file)
-            # TODO: find a way to detect conflicts and show how they were 
+            # TODO: find a way to detect conflicts and show how they were
             #       solved (kind of 3-way diff - theirs/mine/merged)
             edits = [p for p in parents if str_file in p.manifest()]
 
@@ -1229,7 +1229,7 @@
                 action = Changeset.MOVE
             else:
                 action = Changeset.COPY
-            changes.append((f, Node.FILE, action, u(str_base_path), 
+            changes.append((f, Node.FILE, action, u(str_base_path),
                             base_ctx.rev()))
         # remaining str_deletions are real deletions
         for str_file, p in str_deletions.items():
@@ -1241,5 +1241,5 @@
 
     def get_branches(self):
         """Yield branch names to which this changeset belong."""
-        return self.branch and [(self.branch, 
+        return self.branch and [(self.branch,
                                  len(self.ctx.children()) == 0)] or []