81 |
81 |
82 def filectx(self, path, fileid=None): |
82 def filectx(self, path, fileid=None): |
83 """get a file context from this changeset""" |
83 """get a file context from this changeset""" |
84 if fileid is None: |
84 if fileid is None: |
85 fileid = self.filenode(path) |
85 fileid = self.filenode(path) |
86 return filectx(self._repo, path, fileid=fileid) |
86 return filectx(self._repo, path, fileid=fileid, changectx=self) |
87 |
87 |
88 def filectxs(self): |
88 def filectxs(self): |
89 """generate a file context for each file in this changeset's |
89 """generate a file context for each file in this changeset's |
90 manifest""" |
90 manifest""" |
91 mf = self.manifest() |
91 mf = self.manifest() |
102 return changectx(self._repo, n) |
102 return changectx(self._repo, n) |
103 |
103 |
104 class filectx(object): |
104 class filectx(object): |
105 """A filecontext object makes access to data related to a particular |
105 """A filecontext object makes access to data related to a particular |
106 filerevision convenient.""" |
106 filerevision convenient.""" |
107 def __init__(self, repo, path, changeid=None, fileid=None, filelog=None): |
107 def __init__(self, repo, path, changeid=None, fileid=None, |
|
108 filelog=None, changectx=None): |
108 """changeid can be a changeset revision, node, or tag. |
109 """changeid can be a changeset revision, node, or tag. |
109 fileid can be a file revision or node.""" |
110 fileid can be a file revision or node.""" |
110 self._repo = repo |
111 self._repo = repo |
111 self._path = path |
112 self._path = path |
112 |
113 |
113 assert changeid is not None or fileid is not None |
114 assert changeid is not None or fileid is not None |
114 |
115 |
115 if filelog: |
116 if filelog: |
116 self._filelog = filelog |
117 self._filelog = filelog |
|
118 if changectx: |
|
119 self._changectx = changectx |
|
120 self._changeid = changectx.node() |
117 |
121 |
118 if fileid is None: |
122 if fileid is None: |
119 self._changeid = changeid |
123 self._changeid = changeid |
120 else: |
124 else: |
121 self._fileid = fileid |
125 self._fileid = fileid |