mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
remove old python scripts
This commit is contained in:
@@ -1,91 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Sdorra
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of SCM-Manager; nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# http://bitbucket.org/sdorra/scm-manager
|
||||
#
|
||||
#
|
||||
|
||||
import sys, os
|
||||
|
||||
pythonPath = os.environ['SCM_PYTHON_PATH']
|
||||
|
||||
if len(pythonPath) > 0:
|
||||
pathParts = pythonPath.split(os.pathsep)
|
||||
for i in range(len(pathParts)):
|
||||
sys.path.insert(i, pathParts[i])
|
||||
|
||||
|
||||
from mercurial import hg, ui, commands
|
||||
from mercurial.node import hex
|
||||
from xml.sax.saxutils import escape
|
||||
import datetime, time
|
||||
|
||||
repositoryPath = os.environ['SCM_REPOSITORY_PATH']
|
||||
|
||||
revision = os.environ['SCM_REVISION']
|
||||
path = os.environ['SCM_PATH']
|
||||
|
||||
repo = hg.repository(ui.ui(), path = repositoryPath)
|
||||
ctx = repo[revision]
|
||||
fctx = ctx[path]
|
||||
|
||||
c = 0
|
||||
lines = fctx.annotate()
|
||||
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
||||
print '<blame-result>'
|
||||
print ' <blamelines>'
|
||||
for line in lines:
|
||||
ctx = line[0].changectx()
|
||||
time = int(ctx.date()[0]) * 1000
|
||||
authorName = ctx.user();
|
||||
authorMail = None
|
||||
|
||||
if authorName:
|
||||
start = authorName.find('<')
|
||||
end = authorName.find('>')
|
||||
if start > 0 and end > 0:
|
||||
authorMail = authorName[start + 1:end].strip()
|
||||
authorName = authorName[0:start].strip()
|
||||
|
||||
c += 1
|
||||
print ' <blameline>'
|
||||
print ' <lineNumber>' + str(c) + '</lineNumber>'
|
||||
print ' <revision>' + hex(ctx.node()[:6]) + '</revision>'
|
||||
print ' <when>' + str(time).split('.')[0] + '</when>'
|
||||
if authorName:
|
||||
print ' <author>'
|
||||
print ' <name>' + authorName + '</name>'
|
||||
if authorMail:
|
||||
print ' <mail>' + authorMail + '</mail>'
|
||||
print ' </author>'
|
||||
print ' <description>' + escape(ctx.description()) + '</description>'
|
||||
print ' <code>' + escape(line[1][:-1]) + '</code>'
|
||||
print ' </blameline>'
|
||||
|
||||
print ' </blamelines>'
|
||||
print ' <total>' + str(c) + '</total>'
|
||||
print '</blame-result>'
|
||||
@@ -1,154 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Sdorra
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of SCM-Manager; nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# http://bitbucket.org/sdorra/scm-manager
|
||||
#
|
||||
#
|
||||
|
||||
class SubRepository:
|
||||
url = None
|
||||
revision = None
|
||||
|
||||
import sys, os
|
||||
|
||||
pythonPath = os.environ['SCM_PYTHON_PATH']
|
||||
|
||||
if len(pythonPath) > 0:
|
||||
pathParts = pythonPath.split(os.pathsep)
|
||||
for i in range(len(pathParts)):
|
||||
sys.path.insert(i, pathParts[i])
|
||||
|
||||
|
||||
from mercurial import hg, ui
|
||||
import datetime, time
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
def getName(path):
|
||||
parts = path.split('/')
|
||||
length = len(parts)
|
||||
if path.endswith('/'):
|
||||
length =- 1
|
||||
return parts[length - 1]
|
||||
|
||||
repositoryPath = os.environ['SCM_REPOSITORY_PATH']
|
||||
|
||||
revision = os.environ['SCM_REVISION']
|
||||
path = os.environ['SCM_PATH']
|
||||
name = getName(path)
|
||||
length = 0
|
||||
paths = []
|
||||
repo = hg.repository(ui.ui(), path = repositoryPath)
|
||||
subrepos = {}
|
||||
revCtx = repo[revision]
|
||||
mf = revCtx.manifest()
|
||||
try:
|
||||
hgsub = revCtx.filectx('.hgsub').data().split('\n')
|
||||
for line in hgsub:
|
||||
parts = line.split('=')
|
||||
if len(parts) > 1:
|
||||
subrepo = SubRepository()
|
||||
subrepo.url = parts[1].strip()
|
||||
subrepos[parts[0].strip()] = subrepo
|
||||
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
||||
except Exception:
|
||||
# howto drop execptions in python?
|
||||
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'
|
||||
|
||||
try:
|
||||
hgsubstate = revCtx.filectx('.hgsubstate').data().split('\n')
|
||||
for line in hgsubstate:
|
||||
parts = line.split(' ')
|
||||
if len(parts) > 1:
|
||||
subrev = parts[0].strip()
|
||||
subrepo = subrepos[parts[1].strip()]
|
||||
subrepo.revision = subrev
|
||||
except Exception:
|
||||
# howto drop execptions in python?
|
||||
print ''
|
||||
|
||||
if path is "":
|
||||
length = 1
|
||||
for f in mf:
|
||||
paths.append(f)
|
||||
else:
|
||||
length = len(path.split('/')) + 1
|
||||
for f in mf:
|
||||
if f.startswith(path):
|
||||
paths.append(f)
|
||||
|
||||
files = []
|
||||
directories = []
|
||||
|
||||
for k, v in subrepos.iteritems():
|
||||
if k.startswith(path):
|
||||
directories.append(k)
|
||||
|
||||
for p in paths:
|
||||
parts = p.split('/')
|
||||
depth = len(parts)
|
||||
if depth is length:
|
||||
file = repo[revision][p]
|
||||
files.append(file)
|
||||
elif depth > length:
|
||||
dirpath = ''
|
||||
for i in range(0, length):
|
||||
dirpath += parts[i] + '/'
|
||||
if not dirpath in directories:
|
||||
directories.append(dirpath)
|
||||
|
||||
print '<browser-result>'
|
||||
print ' <revision>' + revision + '</revision>'
|
||||
# todo print tag, and branch
|
||||
print ' <files>'
|
||||
for dir in directories:
|
||||
print ' <file>'
|
||||
print ' <name>' + getName(dir) + '</name>'
|
||||
print ' <path>' + dir + '</path>'
|
||||
print ' <directory>true</directory>'
|
||||
if dir in subrepos:
|
||||
subrepo = subrepos[dir]
|
||||
print ' <subrepository>'
|
||||
if subrepo.revision != None:
|
||||
print ' <revision>' + subrepo.revision + '</revision>'
|
||||
print ' <repository-url>' + subrepo.url + '</repository-url>'
|
||||
print ' </subrepository>'
|
||||
print ' </file>'
|
||||
|
||||
for file in files:
|
||||
linkrev = repo[file.linkrev()]
|
||||
time = int(linkrev.date()[0]) * 1000
|
||||
desc = linkrev.description()
|
||||
print ' <file>'
|
||||
print ' <name>' + getName(file.path()) + '</name>'
|
||||
print ' <path>' + file.path() + '</path>'
|
||||
print ' <directory>false</directory>'
|
||||
print ' <length>' + str(file.size()) + '</length>'
|
||||
print ' <lastModified>' + str(time).split('.')[0] + '</lastModified>'
|
||||
print ' <description>' + escape(desc) + '</description>'
|
||||
print ' </file>'
|
||||
print ' </files>'
|
||||
print '</browser-result>'
|
||||
@@ -1,62 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Sdorra
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of SCM-Manager; nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# http://bitbucket.org/sdorra/scm-manager
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# registration .hg/hgrc:
|
||||
#
|
||||
# [hooks]
|
||||
# changegroup.scm = python:scmhooks.callback
|
||||
#
|
||||
|
||||
import os, urllib
|
||||
|
||||
baseUrl = "${url}"
|
||||
challenge = "${challenge}"
|
||||
credentials = os.environ['SCM_CREDENTIALS']
|
||||
|
||||
def callback(ui, repo, hooktype, node=None, source=None, pending=None, **kwargs):
|
||||
if pending != None:
|
||||
pending()
|
||||
failure = True
|
||||
if node != None:
|
||||
try:
|
||||
url = baseUrl + hooktype
|
||||
ui.debug( "send scm-hook to " + url + " and " + node + "\n" )
|
||||
data = urllib.urlencode({'node': node, 'challenge': challenge, 'credentials': credentials, 'repositoryPath': repo.root})
|
||||
conn = urllib.urlopen(url, data);
|
||||
if conn.code >= 200 and conn.code < 300:
|
||||
ui.debug( "scm-hook " + hooktype + " success with status code " + str(conn.code) + "\n" )
|
||||
failure = False
|
||||
else:
|
||||
ui.warn( "scm-hook failed with error code " + str(conn.code) + "\n" )
|
||||
except ValueError:
|
||||
ui.warn( "scm-hook failed with an exception\n" )
|
||||
return failure
|
||||
@@ -1,217 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Sdorra
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of SCM-Manager; nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# http://bitbucket.org/sdorra/scm-manager
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
# import basic modules
|
||||
import sys, os
|
||||
|
||||
# create python path
|
||||
pythonPath = os.environ['SCM_PYTHON_PATH']
|
||||
|
||||
if len(pythonPath) > 0:
|
||||
pathParts = pythonPath.split(os.pathsep)
|
||||
for i in range(len(pathParts)):
|
||||
sys.path.insert(i, pathParts[i])
|
||||
|
||||
# import mercurial modules
|
||||
from mercurial import hg, ui, commands
|
||||
from mercurial.node import hex
|
||||
from xml.dom.minidom import Document
|
||||
|
||||
# util methods
|
||||
def openRepository():
|
||||
repositoryPath = os.environ['SCM_REPOSITORY_PATH']
|
||||
return hg.repository(ui.ui(), path = repositoryPath)
|
||||
|
||||
def writeXml(doc):
|
||||
# print doc.toprettyxml(indent=" ")
|
||||
doc.writexml(sys.stdout, encoding='UTF-8')
|
||||
|
||||
def createChildNode(doc, parentNode, name):
|
||||
node = doc.createElement(name)
|
||||
parentNode.appendChild(node)
|
||||
return node
|
||||
|
||||
def appendValue(doc, node, value):
|
||||
textNode = doc.createTextNode(value)
|
||||
node.appendChild(textNode)
|
||||
|
||||
def appendTextNode(doc, parentNode, name, value):
|
||||
node = createChildNode(doc, parentNode, name)
|
||||
appendValue(doc, node, value)
|
||||
|
||||
def appendListNodes(doc, parentNode, name, values):
|
||||
if values:
|
||||
for value in values:
|
||||
appendTextNode(doc, parentNode, name, value)
|
||||
|
||||
def appendWrappedListNodes(doc, parentNode, wrapperName, name, values):
|
||||
if values:
|
||||
wrapperNode = createChildNode(doc, parentNode, wrapperName)
|
||||
appendListNodes(doc, wrapperNode, name, values)
|
||||
|
||||
# changeset methods
|
||||
|
||||
def getId(ctx):
|
||||
return str(ctx.rev()) + ':' + hex(ctx.node()[:6])
|
||||
|
||||
def appendIdNode(doc, parentNode, ctx):
|
||||
id = getId(ctx)
|
||||
appendTextNode(doc, parentNode, 'id', id)
|
||||
|
||||
def appendParentNodes(doc, parentNode, ctx):
|
||||
parents = ctx.parents()
|
||||
if parents:
|
||||
for parent in parents:
|
||||
parentId = getId(parent)
|
||||
appendTextNode(doc, parentNode, 'parents', parentId)
|
||||
|
||||
def appendDateNode(doc, parentNode, ctx):
|
||||
time = int(ctx.date()[0]) * 1000
|
||||
date = str(time).split('.')[0]
|
||||
appendTextNode(doc, parentNode, 'date', date)
|
||||
|
||||
def appendAuthorNodes(doc, parentNode, ctx):
|
||||
authorName = ctx.user()
|
||||
authorMail = None
|
||||
if authorName:
|
||||
authorNode = createChildNode(doc, parentNode, 'author')
|
||||
s = authorName.find('<')
|
||||
e = authorName.find('>')
|
||||
if s > 0 and e > 0:
|
||||
authorMail = authorName[s + 1:e].strip()
|
||||
authorName = authorName[0:s].strip()
|
||||
appendTextNode(doc, authorNode, 'mail', authorMail)
|
||||
|
||||
appendTextNode(doc, authorNode, 'name', authorName)
|
||||
|
||||
def appendBranchesNode(doc, parentNode, ctx):
|
||||
branch = ctx.branch()
|
||||
if branch != 'default':
|
||||
appendTextNode(doc, parentNode, 'branches', branch)
|
||||
|
||||
def appendModifications(doc, parentNode, ctx):
|
||||
status = repo.status(ctx.p1().node(), ctx.node())
|
||||
if status:
|
||||
modificationsNode = createChildNode(doc, parentNode, 'modifications')
|
||||
appendWrappedListNodes(doc, modificationsNode, 'added', 'file', status[1])
|
||||
appendWrappedListNodes(doc, modificationsNode, 'modified', 'file', status[0])
|
||||
appendWrappedListNodes(doc, modificationsNode, 'removed', 'file', status[2])
|
||||
|
||||
def appendChangesetNode(doc, parentNode, ctx):
|
||||
changesetNode = createChildNode(doc, parentNode, 'changeset')
|
||||
appendIdNode(doc, changesetNode, ctx)
|
||||
appendParentNodes(doc, changesetNode, ctx)
|
||||
appendTextNode(doc, changesetNode, 'description', ctx.description())
|
||||
appendDateNode(doc, changesetNode, ctx)
|
||||
appendAuthorNodes(doc, changesetNode, ctx)
|
||||
appendBranchesNode(doc, changesetNode, ctx)
|
||||
appendListNodes(doc, changesetNode, 'tags', ctx.tags())
|
||||
appendModifications(doc, changesetNode, ctx)
|
||||
|
||||
# changeset methods end
|
||||
|
||||
# change log methods
|
||||
|
||||
def createBasicNodes(doc, ctxs):
|
||||
rootNode = doc.createElement('changeset-paging')
|
||||
doc.appendChild(rootNode)
|
||||
total = str(len(repo))
|
||||
appendTextNode(doc, rootNode, 'total', total)
|
||||
return createChildNode(doc, rootNode, 'changesets')
|
||||
|
||||
def appendChangesetsForPath(doc, repo, rev, path):
|
||||
if len(rev) <= 0:
|
||||
rev = "tip"
|
||||
fctxs = repo[rev].filectx(path)
|
||||
maxRev = fctxs.rev()
|
||||
revs = []
|
||||
for i in fctxs.filelog():
|
||||
fctx = fctxs.filectx(i)
|
||||
if fctx.rev() <= maxRev:
|
||||
revs.append(fctx.changectx())
|
||||
# reverse changesets
|
||||
revs.reverse()
|
||||
# handle paging
|
||||
start = os.environ['SCM_PAGE_START']
|
||||
limit = os.environ['SCM_PAGE_LIMIT']
|
||||
if len(start) > 0:
|
||||
revs = revs[int(start):]
|
||||
if len(limit) > 0:
|
||||
revs = revs[:int(limit)]
|
||||
# output
|
||||
changesets = createBasicNodes(doc, revs)
|
||||
for ctx in revs:
|
||||
appendChangesetNode(doc, changesets, ctx)
|
||||
|
||||
def appendChangesetsForStartAndEnd(doc, repo, startRev, endRev):
|
||||
changesets = createBasicNodes(doc, repo)
|
||||
for i in range(endRev, startRev, -1):
|
||||
appendChangesetNode(doc, changesets, repo[i])
|
||||
|
||||
# change log methods
|
||||
|
||||
# main method
|
||||
|
||||
repo = openRepository()
|
||||
doc = Document()
|
||||
|
||||
path = os.environ['SCM_PATH']
|
||||
startNode = os.environ['SCM_REVISION_START']
|
||||
endNode = os.environ['SCM_REVISION_END']
|
||||
rev = os.environ['SCM_REVISION']
|
||||
|
||||
if len(path) > 0:
|
||||
appendChangesetsForPath(doc, repo, rev, path)
|
||||
elif len(rev) > 0:
|
||||
ctx = repo[rev]
|
||||
appendChangesetNode(doc, doc, ctx)
|
||||
else:
|
||||
if len(startNode) > 0 and len(endNode) > 0:
|
||||
# start and end revision
|
||||
startRev = repo[startNode].rev() -1
|
||||
endRev = repo[endNode].rev()
|
||||
else:
|
||||
# paging
|
||||
start = os.environ['SCM_PAGE_START']
|
||||
limit = os.environ['SCM_PAGE_LIMIT']
|
||||
limit = int(limit)
|
||||
end = int(start)
|
||||
endRev = len(repo) - end - 1
|
||||
startRev = endRev - limit
|
||||
# fix negative start revisions
|
||||
if startRev < -1:
|
||||
startRev = -1
|
||||
# print
|
||||
appendChangesetsForStartAndEnd(doc, repo, startRev, endRev)
|
||||
|
||||
# write document
|
||||
writeXml(doc)
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env ${python}
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Sdorra
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. Neither the name of SCM-Manager; nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# http://bitbucket.org/sdorra/scm-manager
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
import os, sys
|
||||
pythonPath = os.environ['SCM_PYTHON_PATH']
|
||||
|
||||
if len(pythonPath) > 0:
|
||||
pathParts = pythonPath.split(os.pathsep)
|
||||
for i in range(len(pathParts)):
|
||||
sys.path.insert(i, pathParts[i])
|
||||
|
||||
repositoryPath = os.environ['SCM_REPOSITORY_PATH']
|
||||
|
||||
from mercurial import demandimport; demandimport.enable()
|
||||
from mercurial.hgweb import hgweb, wsgicgi
|
||||
application = hgweb(repositoryPath)
|
||||
wsgicgi.launch(application)
|
||||
Reference in New Issue
Block a user