equal
deleted
inserted
replaced
123 :pos: is the revision relative to which we generate navigation. |
123 :pos: is the revision relative to which we generate navigation. |
124 :pagelen: the size of each navigation page |
124 :pagelen: the size of each navigation page |
125 :limit: how far shall we link |
125 :limit: how far shall we link |
126 |
126 |
127 The return is: |
127 The return is: |
128 - a single element tuple |
128 - a single element mappinglist |
129 - containing a dictionary with a `before` and `after` key |
129 - containing a dictionary with a `before` and `after` key |
130 - values are dictionaries with `label` and `node` keys |
130 - values are dictionaries with `label` and `node` keys |
131 """ |
131 """ |
132 if not self: |
132 if not self: |
133 # empty repo |
133 # empty repo |
134 return ({'before': (), 'after': ()},) |
134 return templateutil.mappinglist([ |
|
135 {'before': templateutil.mappinglist([]), |
|
136 'after': templateutil.mappinglist([])}, |
|
137 ]) |
135 |
138 |
136 targets = [] |
139 targets = [] |
137 for f in _navseq(1, pagelen): |
140 for f in _navseq(1, pagelen): |
138 if f > limit: |
141 if f > limit: |
139 break |
142 break |
154 navbefore.append({'label': '-%d' % abs(rev - pos), |
157 navbefore.append({'label': '-%d' % abs(rev - pos), |
155 'node': self.hex(rev)}) |
158 'node': self.hex(rev)}) |
156 |
159 |
157 navafter.append({'label': 'tip', 'node': 'tip'}) |
160 navafter.append({'label': 'tip', 'node': 'tip'}) |
158 |
161 |
159 return ({'before': navbefore, 'after': navafter},) |
162 # TODO: maybe this can be a scalar object supporting tomap() |
|
163 return templateutil.mappinglist([ |
|
164 {'before': templateutil.mappinglist(navbefore), |
|
165 'after': templateutil.mappinglist(navafter)}, |
|
166 ]) |
160 |
167 |
161 class filerevnav(revnav): |
168 class filerevnav(revnav): |
162 |
169 |
163 def __init__(self, repo, path): |
170 def __init__(self, repo, path): |
164 """Navigation generation object |
171 """Navigation generation object |