diff hggit/__init__.py @ 1115:8ed6c0cae9b8

cleanup: add some blank lines
author Sean Farley <sean@farley.io>
date Mon, 27 Nov 2017 18:46:07 -0500
parents bb255eaf3d14
children bd1a01f98154
line wrap: on
line diff
--- a/hggit/__init__.py	Mon Nov 27 18:34:24 2017 -0500
+++ b/hggit/__init__.py	Mon Nov 27 18:46:07 2017 -0500
@@ -112,6 +112,7 @@
         def localpath(self):
             return self.p
 
+
 def _isgitdir(path):
     """True if the given file path is a git repo."""
     if os.path.exists(os.path.join(path, '.hg')):
@@ -129,6 +130,7 @@
 
     return False
 
+
 def _local(path):
     p = urlcls(path).localpath()
     if _isgitdir(p):
@@ -138,8 +140,10 @@
         return gitrepo
     return _oldlocal(path)
 
+
 hg.schemes['file'] = _local
 
+
 # we need to wrap this so that git-like ssh paths are not prepended with a
 # local filesystem path. ugh.
 def _url(orig, path, **kwargs):
@@ -157,6 +161,7 @@
         return orig(gituri, **kwargs)
     return orig(path, **kwargs)
 
+
 extensions.wrapfunction(hgutil, 'url', _url)
 
 
@@ -172,10 +177,12 @@
 
     return httpgitscheme
 
+
 hg.schemes['https'] = _httpgitwrapper(hg.schemes['https'])
 hg.schemes['http'] = _httpgitwrapper(hg.schemes['http'])
+hgdefaultdest = hg.defaultdest
 
-hgdefaultdest = hg.defaultdest
+
 def defaultdest(source):
     for scheme in util.gitschemes:
         if source.startswith('%s://' % scheme) and source.endswith('.git'):
@@ -185,23 +192,30 @@
         return hgdefaultdest(source[:-4])
 
     return hgdefaultdest(source)
+
+
 hg.defaultdest = defaultdest
 
+
 def getversion():
     """return version with dependencies for hg --version -v"""
     import dulwich
     dulver = '.'.join(str(i) for i in dulwich.__version__)
     return __version__ + (" (dulwich %s)" % dulver)
 
+
 # defend against tracebacks if we specify -r in 'hg pull'
 def safebranchrevs(orig, lrepo, repo, branches, revs):
     revs, co = orig(lrepo, repo, branches, revs)
     if hgutil.safehasattr(lrepo, 'changelog') and co not in lrepo.changelog:
         co = None
     return revs, co
+
+
 if getattr(hg, 'addbranchrevs', False):
     extensions.wrapfunction(hg, 'addbranchrevs', safebranchrevs)
 
+
 def extsetup(ui):
     templatekw.keywords.update({'gitnode': gitnodekw})
     revset.symbols.update({
@@ -213,6 +227,7 @@
              lambda *args: open(os.path.join(helpdir, 'git.rst')).read())
     insort(help.helptable, entry)
 
+
 def reposetup(ui, repo):
     if not isinstance(repo, gitrepo.gitrepo):
 
@@ -231,21 +246,25 @@
         klass = hgrepo.generate_repo_subclass(repo.__class__)
         repo.__class__ = klass
 
+
 if hgutil.safehasattr(manifest, '_lazymanifest'):
     # Mercurial >= 3.4
     extensions.wrapfunction(manifest.manifestdict, 'diff',
                             overlay.wrapmanifestdictdiff)
 
+
 @command('gimport')
 def gimport(ui, repo, remote_name=None):
     '''import commits from Git to Mercurial'''
     repo.githandler.import_commits(remote_name)
 
+
 @command('gexport')
 def gexport(ui, repo):
     '''export commits from Mercurial to Git'''
     repo.githandler.export_commits()
 
+
 @command('gclear')
 def gclear(ui, repo):
     '''clear out the Git cached data
@@ -258,6 +277,7 @@
     repo.ui.status(_("clearing out the git cache data\n"))
     repo.githandler.clear()
 
+
 @command('gverify',
          [('r', 'rev', '', _('revision to verify'), _('REV'))],
          _('[-r REV]'))
@@ -272,6 +292,7 @@
     ctx = scmutil.revsingle(repo, opts.get('rev'), '.')
     return verify.verify(ui, repo, ctx)
 
+
 @command('git-cleanup')
 def git_cleanup(ui, repo):
     '''clean up Git commit map after history editing'''
@@ -289,6 +310,7 @@
         wlock.release()
     ui.status(_('git commit map cleaned\n'))
 
+
 def findcommonoutgoing(orig, repo, other, *args, **kwargs):
     if isinstance(other, gitrepo.gitrepo):
         heads = repo.githandler.get_refs(other.path)[0]
@@ -305,8 +327,11 @@
             kw['commoninc'] = commoninc
         return orig(repo, other, **kw)
     return orig(repo, other, *args, **kwargs)
+
+
 extensions.wrapfunction(discovery, 'findcommonoutgoing', findcommonoutgoing)
 
+
 def getremotechanges(orig, ui, repo, other, *args, **opts):
     if isinstance(other, gitrepo.gitrepo):
         if args:
@@ -319,22 +344,31 @@
             cleanup = None
         return r, c, cleanup
     return orig(ui, repo, other, *args, **opts)
+
+
 extensions.wrapfunction(bundlerepo, 'getremotechanges', getremotechanges)
 
+
 def peer(orig, uiorrepo, *args, **opts):
     newpeer = orig(uiorrepo, *args, **opts)
     if isinstance(newpeer, gitrepo.gitrepo):
         if isinstance(uiorrepo, localrepo.localrepository):
             newpeer.localrepo = uiorrepo
     return newpeer
+
+
 extensions.wrapfunction(hg, 'peer', peer)
 
+
 def isvalidlocalpath(orig, self, path):
     return orig(self, path) or _isgitdir(path)
+
+
 if (hgutil.safehasattr(hgui, 'path') and
     hgutil.safehasattr(hgui.path, '_isvalidlocalpath')):
     extensions.wrapfunction(hgui.path, '_isvalidlocalpath', isvalidlocalpath)
 
+
 @util.transform_notgit
 def exchangepull(orig, repo, remote, heads=None, force=False, bookmarks=(),
                  **kwargs):
@@ -366,10 +400,13 @@
             wlock.release()
     else:
         return orig(repo, remote, heads, force, bookmarks=bookmarks, **kwargs)
+
+
 if not hgutil.safehasattr(localrepo.localrepository, 'pull'):
     # Mercurial >= 3.2
     extensions.wrapfunction(exchange, 'pull', exchangepull)
 
+
 # TODO figure out something useful to do with the newbranch param
 @util.transform_notgit
 def exchangepush(orig, repo, remote, force=False, revs=None, newbranch=False,
@@ -386,10 +423,13 @@
     else:
         return orig(repo, remote, force, revs, newbranch, bookmarks=bookmarks,
                     **kwargs)
+
+
 if not hgutil.safehasattr(localrepo.localrepository, 'push'):
     # Mercurial >= 3.2
     extensions.wrapfunction(exchange, 'push', exchangepush)
 
+
 def revset_fromgit(repo, subset, x):
     '''``fromgit()``
     Select changesets that originate from Git.
@@ -400,6 +440,7 @@
     return baseset(r for r in subset
                    if git.map_git_get(hex(node(r))) is not None)
 
+
 def revset_gitnode(repo, subset, x):
     '''``gitnode(hash)``
     Select the changeset that originates in the given Git revision. The hash
@@ -422,6 +463,7 @@
         return result
     raise LookupError(rev, git.map_file, _('ambiguous identifier'))
 
+
 def gitnodekw(**args):
     """:gitnode: String.  The Git changeset identification hash, as a 40 hexadecimal digit string."""
     node = args['ctx']