From f16a3a4134dccad4981999b3b5d67e92a4c1d002 Mon Sep 17 00:00:00 2001 From: Durham Goode Date: Fri, 21 Jun 2013 10:14:29 -0700 Subject: [PATCH] Rename to remotefilelog since shallowrepo is already taken --- Makefile | 6 ++--- {hgshallowrepo => remotefilelog}/__init__.py | 26 +++++++++---------- .../fileserverclient.py | 9 ++++--- .../remotefilectx.py | 6 ++--- .../remotefilelog.py | 2 +- .../shallowbundle.py | 6 ++--- .../shallowrepo.py | 2 +- .../shallowstore.py | 6 +++++ setup.py | 12 ++++----- 9 files changed, 40 insertions(+), 35 deletions(-) rename {hgshallowrepo => remotefilelog}/__init__.py (96%) rename {hgshallowrepo => remotefilelog}/fileserverclient.py (95%) rename {hgshallowrepo => remotefilelog}/remotefilectx.py (98%) rename {hgshallowrepo => remotefilelog}/remotefilelog.py (99%) rename {hgshallowrepo => remotefilelog}/shallowbundle.py (95%) rename {hgshallowrepo => remotefilelog}/shallowrepo.py (98%) rename {hgshallowrepo => remotefilelog}/shallowstore.py (85%) diff --git a/Makefile b/Makefile index 44ab3bcd9c..d0bc8f0068 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,10 @@ PYTHON=python .PHONY: tests -PREFIX=/usr/local - help: @echo 'Commonly used make targets:' @echo ' local - build for inplace use' - @echo ' install - install program and man pages to PREFIX ($(PREFIX))' + @echo ' install - install program' @echo ' clean - remove files created by other targets' @echo ' (except installed files or dist source tarball)' @@ -17,7 +15,7 @@ local: build_ext -i install: - $(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force + $(PYTHON) setup.py $(PURE) install --force clean: -$(PYTHON) setup.py clean --all # ignore errors from this command diff --git a/hgshallowrepo/__init__.py b/remotefilelog/__init__.py similarity index 96% rename from hgshallowrepo/__init__.py rename to remotefilelog/__init__.py index 7decbb8e80..aaffe1d761 100644 --- a/hgshallowrepo/__init__.py +++ b/remotefilelog/__init__.py @@ -22,9 +22,9 @@ import struct, zlib, errno, collections, time, os, pdb, socket, subprocess, lz4 import stat shallowremote = False +localrepo.localrepository.supported.add('remotefilelog') def uisetup(ui): - localrepo.localrepository.requirements.append('shallowrepo') entry = extensions.wrapcommand(commands.table, 'clone', cloneshallow) entry[1].append(('', 'shallow', None, _("create a shallow clone which uses remote file history"))) @@ -34,7 +34,7 @@ def uisetup(ui): # Prevent 'hg manifest --all' def _manifest(orig, ui, repo, *args, **opts): - if "shallowrepo" in repo.requirements and opts.get('all'): + if "remotefilelog" in repo.requirements and opts.get('all'): raise util.Abort(_("--all is not supported in a shallow repo")) return orig(ui, repo, *args, **opts) @@ -52,7 +52,7 @@ def cloneshallow(orig, ui, repo, *args, **opts): self.__class__.__bases__ = (self.__class__.__bases__[0], self.unfiltered().__class__) - requirements.add('shallowrepo') + requirements.add('remotefilelog') # if the repo was filtered, we need to refilter since # the class has changed @@ -70,7 +70,7 @@ def reposetup(ui, repo): return isserverenabled = ui.configbool('remotefilelog', 'server') - isshallowclient = "shallowrepo" in repo.requirements + isshallowclient = "remotefilelog" in repo.requirements if isserverenabled and isshallowclient: raise Exception("Cannot be both a server and shallow client.") @@ -115,7 +115,7 @@ def onetimesetup(ui): def _walkstreamfiles(orig, repo): if shallowremote: # if we are shallow ourselves, stream our local commits - if "shallowrepo" in repo.requirements: + if "remotefilelog" in repo.requirements: striplen = len(repo.store.path) + 1 readdir = repo.store.rawvfs.readdir visit = [os.path.join(repo.store.path, 'data')] @@ -131,7 +131,7 @@ def onetimesetup(ui): for x in repo.store.topfiles(): yield x - elif "shallowrepo" in repo.requirements: + elif "remotefilelog" in repo.requirements: # don't allow cloning from a shallow repo to a full repo # since it would require fetching every version of every # file in order to create the revlogs. @@ -184,7 +184,7 @@ def onetimeclientsetup(ui): def storewrapper(orig, requirements, path, vfstype): s = orig(requirements, path, vfstype) - if 'shallowrepo' in requirements: + if 'remotefilelog' in requirements: s = shallowstore.wrapstore(s) return s @@ -192,7 +192,7 @@ def onetimeclientsetup(ui): # prefetch files before update hook def applyupdates(orig, repo, actions, wctx, mctx, actx, overwrite): - if 'shallowrepo' in repo.requirements: + if 'remotefilelog' in repo.requirements: manifest = mctx.manifest() files = [] for f, m, args, msg in [a for a in actions if a[1] == 'g']: @@ -218,7 +218,7 @@ def onetimeclientsetup(ui): # prevent strip from considering filelogs def _collectbrokencsets(orig, repo, files, striprev): - if 'shallowrepo' in repo.requirements: + if 'remotefilelog' in repo.requirements: files = [] return orig(repo, files, striprev) wrapfunction(repair, '_collectbrokencsets', _collectbrokencsets) @@ -252,14 +252,14 @@ def onetimeclientsetup(ui): def filectx(orig, self, path, fileid=None, filelog=None): if fileid is None: fileid = self.filenode(path) - if 'shallowrepo' in self._repo.requirements: + if 'remotefilelog' in self._repo.requirements: return remotefilectx.remotefilectx(self._repo, path, fileid=fileid, changectx=self, filelog=filelog) return orig(self, path, fileid=fileid, filelog=filelog) wrapfunction(context.changectx, 'filectx', filectx) def workingfilectx(orig, self, path, filelog=None): - if 'shallowrepo' in self._repo.requirements: + if 'remotefilelog' in self._repo.requirements: return remotefilectx.remoteworkingfilectx(self._repo, path, workingctx=self, filelog=filelog) return orig(self, path, filelog=filelog) @@ -360,7 +360,7 @@ def getrenamedfn(repo, endrev=None): return getrenamed def walkfilerevs(orig, repo, match, follow, revs, fncache): - if not "shallowrepo" in repo.requirements: + if not "remotefilelog" in repo.requirements: return orig(repo, match, follow, revs, fncache) if not follow: @@ -398,7 +398,7 @@ def filelogrevset(orig, repo, subset, x): a slower, more accurate result, use ``file()``. """ - if not "shallowrepo" in repo.requirements: + if not "remotefilelog" in repo.requirements: return orig(repo, subset, x) # i18n: "filelog" is a keyword diff --git a/hgshallowrepo/fileserverclient.py b/remotefilelog/fileserverclient.py similarity index 95% rename from hgshallowrepo/fileserverclient.py rename to remotefilelog/fileserverclient.py index 1775dd36e1..dd729b6208 100644 --- a/hgshallowrepo/fileserverclient.py +++ b/remotefilelog/fileserverclient.py @@ -1,4 +1,4 @@ -# fileserverclient.py - client for communicating with the file server +# fileserverclient.py - client for communicating with the cache process # # Copyright 2013 Facebook, Inc. # @@ -18,7 +18,6 @@ contentbytes = 0 metadatabytes = 0 _downloading = _('downloading') -_memcache = 'scmmemcache'; client = None @@ -32,6 +31,8 @@ class fileserverclient(object): def __init__(self, ui): self.ui = ui self.cachepath = ui.config("remotefilelog", "cachepath") + self.cacheprocess = ui.config("remotefilelog", "cacheprocess") + self.debugoutput = ui.configbool("remotefilelog", "debug") self.pipeo = self.pipei = self.pipee = None @@ -139,10 +140,10 @@ class fileserverclient(object): return missing def connect(self): - self.pipei, self.pipeo, self.pipee, self.subprocess = util.popen4(_memcache) + self.pipei, self.pipeo, self.pipee, self.subprocess = util.popen4(self.cacheprocess) def close(self): - if fetches: + if fetches and self.debugoutput: print ("%s fetched over %d fetches - %0.2f MB (%0.2f MB content / %0.2f MB metadata) " + "over %0.2fs = %0.2f MB/s") % ( fetched, diff --git a/hgshallowrepo/remotefilectx.py b/remotefilelog/remotefilectx.py similarity index 98% rename from hgshallowrepo/remotefilectx.py rename to remotefilelog/remotefilectx.py index 3c58bdfe8a..51cf78cccd 100644 --- a/hgshallowrepo/remotefilectx.py +++ b/remotefilelog/remotefilectx.py @@ -1,4 +1,4 @@ -# remoterevlog.py - revlog implementation where the content is stored remotely +# remotefilectx.py - filectx and workingfilectx implementations for remotefilelog # # Copyright 2013 Facebook, Inc. # @@ -120,7 +120,7 @@ class remotefilectx(context.filectx): ancestors.append((path, node, clrev(linknode))) if p1 != nullid: - queue.append((copyfrom or path, p1)) + queue.append((copyfrom or path, p1)) if p2 != nullid and not followfirst: queue.append((path, p2)) @@ -203,7 +203,7 @@ class remotefilectx(context.filectx): class remoteworkingfilectx(context.workingfilectx, remotefilectx): def __init__(self, repo, path, filelog=None, workingctx=None): self._ancestormap = None - return super(remoteworkingfilectx, self).__init__(repo, path, + return super(remoteworkingfilectx, self).__init__(repo, path, filelog, workingctx) def parents(self): diff --git a/hgshallowrepo/remotefilelog.py b/remotefilelog/remotefilelog.py similarity index 99% rename from hgshallowrepo/remotefilelog.py rename to remotefilelog/remotefilelog.py index 86761c6cde..42d0febc2e 100644 --- a/hgshallowrepo/remotefilelog.py +++ b/remotefilelog/remotefilelog.py @@ -1,4 +1,4 @@ -# remotefilelog.py - revlog implementation where the content is stored remotely +# remotefilelog.py - filelog implementation where filelog history is stored remotely # # Copyright 2013 Facebook, Inc. # diff --git a/hgshallowrepo/shallowbundle.py b/remotefilelog/shallowbundle.py similarity index 95% rename from hgshallowrepo/shallowbundle.py rename to remotefilelog/shallowbundle.py index 2a0ce77101..1d577efedd 100644 --- a/hgshallowrepo/shallowbundle.py +++ b/remotefilelog/shallowbundle.py @@ -1,4 +1,4 @@ -# shallowbundle.py - revlog implementation where the content is stored remotely +# shallowbundle.py - bundle10 implementation for use with shallow repositories # # Copyright 2013 Facebook, Inc. # @@ -14,7 +14,7 @@ from mercurial.i18n import _ shallowremote = False def shouldaddfilegroups(repo, source): - isshallowclient = "shallowrepo" in repo.requirements + isshallowclient = "remotefilelog" in repo.requirements if source == "push": return True if source == "serve": @@ -65,7 +65,7 @@ def sortnodes(nodes, parentfunc): class shallowbundle(changegroup.bundle10): def generate(self, commonrevs, clnodes, fastpathlinkrev, source): - if "shallowrepo" in self._repo.requirements: + if "remotefilelog" in self._repo.requirements: fastpathlinkrev = False return super(shallowbundle, self).generate(commonrevs, clnodes, diff --git a/hgshallowrepo/shallowrepo.py b/remotefilelog/shallowrepo.py similarity index 98% rename from hgshallowrepo/shallowrepo.py rename to remotefilelog/shallowrepo.py index b4babcd70d..cfbd7b6eae 100644 --- a/hgshallowrepo/shallowrepo.py +++ b/remotefilelog/shallowrepo.py @@ -1,4 +1,4 @@ -# shallowrepo.py +# shallowrepo.py - shallow repository that uses remote filelogs # # Copyright 2013 Facebook, Inc. # diff --git a/hgshallowrepo/shallowstore.py b/remotefilelog/shallowstore.py similarity index 85% rename from hgshallowrepo/shallowstore.py rename to remotefilelog/shallowstore.py index 26cea6a33a..7e2b4c12fc 100644 --- a/hgshallowrepo/shallowstore.py +++ b/remotefilelog/shallowstore.py @@ -1,3 +1,9 @@ +# shallowstore.py - shallow store for interacting with shallow repos +# +# Copyright 2013 Facebook, Inc. +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. from mercurial import util from mercurial import store as storemod diff --git a/setup.py b/setup.py index 88d56bcb81..157eef5297 100644 --- a/setup.py +++ b/setup.py @@ -1,18 +1,18 @@ from distutils.core import setup, Extension setup( - name='hgshallowrepo', + name='remotefilelog', version='0.1', author='Durham Goode', maintainer='Durham Goode', maintainer_email='durham@fb.com', - url='https://bitbucket.org/facebook/hgshallowrepo', - description='Shallow repo extension for Mercurial', + url='https://bitbucket.org/facebook/remotefilelog', + description='Remote filelog extension for Mercurial', long_description=""" -This extension adds support for shallow repositories in Mercurial where all the file history is stored remotely. +This extension adds support for remote filelogs in Mercurial where all the file history is stored remotely. """.strip(), - keywords='hg shallow mercurial', + keywords='hg shallow mercurial remote filelog', license='Not determined yet', - packages=['hgshallowrepo'], + packages=['remotefilelog'], ext_modules = [] )