Show More
@@ -11,9 +11,8 b' class changectx(object):' | |||||
11 | def __init__(self, repo, changeid): |
|
11 | def __init__(self, repo, changeid): | |
12 | """changeid is a revision number, node, or tag""" |
|
12 | """changeid is a revision number, node, or tag""" | |
13 | self._repo = repo |
|
13 | self._repo = repo | |
14 | self._id = changeid |
|
|||
15 |
|
14 | |||
16 |
self._node = self._repo.lookup( |
|
15 | self._node = self._repo.lookup(changeid) | |
17 | self._rev = self._repo.changelog.rev(self._node) |
|
16 | self._rev = self._repo.changelog.rev(self._node) | |
18 |
|
17 | |||
19 | def changeset(self): |
|
18 | def changeset(self): | |
@@ -74,39 +73,40 b' class filectx(object):' | |||||
74 | fileid can be a file revision or node.""" |
|
73 | fileid can be a file revision or node.""" | |
75 | self._repo = repo |
|
74 | self._repo = repo | |
76 | self._path = path |
|
75 | self._path = path | |
77 | self._id = changeid |
|
|||
78 | self._fileid = fileid |
|
|||
79 |
|
76 | |||
80 | if self._id: |
|
77 | assert changeid or fileid | |
|
78 | ||||
|
79 | if not fileid: | |||
81 | # if given a changeset id, go ahead and look up the file |
|
80 | # if given a changeset id, go ahead and look up the file | |
82 |
self._change |
|
81 | self._changeid = changeid | |
83 | node, flag = self._repo.manifest.find(self._changeset[0], path) |
|
82 | self._changectx = self.changectx() | |
84 | self._filelog = self._repo.file(self._path) |
|
83 | self._filelog = self._repo.file(self._path) | |
85 | self._filenode = node |
|
84 | self._filenode = self._changectx.filenode(self._path) | |
86 |
el |
|
85 | else: | |
87 | # else be lazy |
|
86 | # else be lazy | |
88 | self._filelog = self._repo.file(self._path) |
|
87 | self._filelog = self._repo.file(self._path) | |
89 |
self._filenode = self._filelog.lookup( |
|
88 | self._filenode = self._filelog.lookup(fileid) | |
|
89 | self._changeid = self._filelog.linkrev(self._filenode) | |||
90 | self._filerev = self._filelog.rev(self._filenode) |
|
90 | self._filerev = self._filelog.rev(self._filenode) | |
91 |
|
91 | |||
92 |
def change |
|
92 | def changectx(self): | |
93 | try: |
|
93 | try: | |
94 |
return self._change |
|
94 | return self._changectx | |
95 | except AttributeError: |
|
95 | except AttributeError: | |
96 |
self._change |
|
96 | self._changectx = changectx(self._repo, self._changeid) | |
97 |
return self._change |
|
97 | return self._changectx | |
98 |
|
98 | |||
99 | def filerev(self): return self._filerev |
|
99 | def filerev(self): return self._filerev | |
100 | def filenode(self): return self._filenode |
|
100 | def filenode(self): return self._filenode | |
101 | def filelog(self): return self._filelog |
|
101 | def filelog(self): return self._filelog | |
102 |
|
102 | |||
103 |
def rev(self): return self.change |
|
103 | def rev(self): return self.changectx().rev() | |
104 |
def node(self): return self.change |
|
104 | def node(self): return self.changectx().node() | |
105 |
def user(self): return self.change |
|
105 | def user(self): return self.changectx().user() | |
106 |
def date(self): return self.change |
|
106 | def date(self): return self.changectx().date() | |
107 |
def files(self): return self.change |
|
107 | def files(self): return self.changectx().files() | |
108 |
def description(self): return self.change |
|
108 | def description(self): return self.changectx().description() | |
109 |
def manifest(self): return self.change |
|
109 | def manifest(self): return self.changectx().manifest() | |
110 |
|
110 | |||
111 | def data(self): return self._filelog.read(self._filenode) |
|
111 | def data(self): return self._filelog.read(self._filenode) | |
112 | def metadata(self): return self._filelog.readmeta(self._filenode) |
|
112 | def metadata(self): return self._filelog.readmeta(self._filenode) |
General Comments 0
You need to be logged in to leave comments.
Login now