mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-22 09:12:19 -05:00
Making xeputil.py work with Mercurial.
This commit is contained in:
parent
83fb3df426
commit
c39f89f3e8
22
xeputil.py
22
xeputil.py
@ -1,5 +1,5 @@
|
|||||||
# File: xeputil.py
|
# File: xeputil.py
|
||||||
# Version: 0.1
|
# Version: 0.2
|
||||||
# Description: xep utility functions
|
# Description: xep utility functions
|
||||||
# Last Modified: 2010
|
# Last Modified: 2010
|
||||||
# Author: Tobias Markmann (tm@ayena.de)
|
# Author: Tobias Markmann (tm@ayena.de)
|
||||||
@ -28,12 +28,14 @@
|
|||||||
#
|
#
|
||||||
## END LICENSE ##
|
## END LICENSE ##
|
||||||
|
|
||||||
import pysvn
|
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
from xepinfo import XEPInfo
|
from xepinfo import XEPInfo
|
||||||
from xml.dom.minidom import parse,parseString,Document,getDOMImplementation
|
from xml.dom.minidom import parse,parseString,Document,getDOMImplementation
|
||||||
|
|
||||||
|
from mercurial import ui, hg
|
||||||
|
from mercurial.node import hex
|
||||||
|
|
||||||
def getText(nodelist):
|
def getText(nodelist):
|
||||||
thisText = ""
|
thisText = ""
|
||||||
for node in nodelist:
|
for node in nodelist:
|
||||||
@ -47,20 +49,20 @@ class XEP:
|
|||||||
self.BASEDIR = BASEDIR
|
self.BASEDIR = BASEDIR
|
||||||
|
|
||||||
def revisions(self):
|
def revisions(self):
|
||||||
client = pysvn.Client(self.BASEDIR);
|
repo = hg.repository(ui.ui(), self.BASEDIR)
|
||||||
rev = client.info("xep-" + self.nr + ".xml").revision.number
|
fctx = repo.filectx('extensions/' + "xep-" + self.nr + ".xml", 'tip')
|
||||||
log = client.log("xep-" + self.nr + ".xml", pysvn.Revision( pysvn.opt_revision_kind.number, 0 ),pysvn.Revision( pysvn.opt_revision_kind.number, rev ), True)
|
|
||||||
|
|
||||||
revs = []
|
revs = []
|
||||||
for l in log:
|
for rev in fctx.filelog():
|
||||||
revs.append(l.revision.number)
|
revs.append(fctx.filectx(rev).rev())
|
||||||
|
|
||||||
return sorted(revs)
|
return sorted(revs)
|
||||||
|
|
||||||
def contentOfRevision(self, revision):
|
def contentOfRevision(self, revision):
|
||||||
client = pysvn.Client(self.BASEDIR);
|
repo = hg.repository(ui.ui(), self.BASEDIR)
|
||||||
|
fctx = repo.filectx('extensions/' + "xep-" + self.nr + ".xml", revision)
|
||||||
|
|
||||||
# load content for that revision
|
# load content for that revision
|
||||||
file_text = client.cat( "xep-" + self.nr + ".xml", pysvn.Revision( pysvn.opt_revision_kind.number, revision))
|
file_text = fctx.data()
|
||||||
return file_text
|
return file_text
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user