Beispiel #1
0
    def fileinfo(self, rev=_cwd, path=None):
        """
        Get the fileinfo in working directory using the working 
        directory context.
        """

        fctx = self._filectx(rev, path)
        if rev is _cwd and path not in fctx.manifest():
            raise PathNotFoundError("path '%s' not found" % path)
        hw = hgweb(self._repo)
        return ext.filerevision(hw, _t, fctx)
Beispiel #2
0
    def log(self, rev=None, branch=None, shortlog=False, 
            datefmt=None, maxchanges=None, *a, **kw):
        """\
        This method returns the history of the repository.

        rev -
            specifies which revision to start the history from.
        branch -
            specifies which branch to check the logs on.

        This method is implemented as a wrapper around hgweb.changelog(),
        so the value return is actually an iterator, and the structure
        will likely change when this class is migrated to a common
        interface.

        This method will not cause the internal context to change.
        """

        # XXX maybe move this into the hgweb_ext
        def changelist(entries, **x):
            for i in entries():
                i['date'] = getdate(i['date'])
                i['email'] = utils.filter(i['author'], 'email')
                if shortlog:
                    i['desc'] = utils.filter(i['desc'], 'firstline')
                    i['author'] = utils.filter(i['author'], 'person')
                yield i

        hw = hgweb(self._repo)
        hw.refresh()

        if maxchanges is not None:
            hw.maxchanges = hw.maxshortchanges = maxchanges

        # This is kind of silly.
        if shortlog and datefmt is None:
            datefmt = 'age'
        elif datefmt is None:
            datefmt = 'isodate'

        getdate = lambda i: utils.filter(i, datefmt)

        # only looking, not changing.
        ctx = self._getctx(rev)
        result = ext.changelog(hw, ctx, _t, shortlog)
        for i in result:
            i['orig_entries'] = i['entries']
            i['entries'] = lambda **x: changelist(i['orig_entries'], **x)
            yield i
Beispiel #3
0
    def status(self, path=''):
        """\
        Status reports the state of the sandbox, for files that may have
        been added, modified, deleted and the like.

        Only compare the first dirstate parent and working directory.

        Returns a dictionary of the list of files.
        """

        # get back to latest working copy because this is what we want.
        ctx = self._changectx(_cwd)
        st = self._repo.status(ignored=True, clean=True)

        hw = hgweb(self._repo)
        return ext.status(hw, _t, self._ctx, path, st)
Beispiel #4
0
 def init(self):
     self.stopped = True
     util.set_signal_handler()
     try:
         baseui = repo and repo.baseui or ui
         repoui = repo and repo.ui != baseui and repo.ui or None
         optlist = ("name templates style address port prefix ipv6"
                    " accesslog errorlog webdir_conf certificate")
         for o in optlist.split():
             if opts[o]:
                 baseui.setconfig("web", o, str(opts[o]))
                 if repoui:
                     repoui.setconfig("web", o, str(opts[o]))
         o = opts.get('web_conf') or opts.get('webdir_conf')
         if o:
             app = hgwebdir_mod.hgwebdir(o, repo.ui)
         else:
             app = hgweb_mod.hgweb(hg.repository(repo.ui, repo.root))
         self.httpd = server.create_server(ui, app)
     except socket.error, inst:
         raise util.Abort(_('cannot start server: ') + inst.args[1])
Beispiel #5
0
 def __make_app(self, repo_name, baseui, extras):
     """
     Make an wsgi application using hgweb, and inject generated baseui
     instance, additionally inject some extras into ui object
     """
     return hgweb_mod.hgweb(repo_name, name=repo_name, baseui=baseui)
Beispiel #6
0
 def __make_app(self, repo_name, baseui, extras):
     """
     Make an wsgi application using hgweb, and inject generated baseui
     instance, additionally inject some extras into ui object
     """
     return hgweb_mod.hgweb(repo_name, name=repo_name, baseui=baseui)
Beispiel #7
0
 def fileinfo(self, rev=None, path=None):
     hw = hgweb(self._repo)
     fctx = self._filectx(rev, path)
     return webcommands._filerevision(hw, _t, fctx)