Show More
@@ -14,6 +14,12 b' import cStringIO' | |||||
14 |
|
14 | |||
15 | _format = ">cllll" |
|
15 | _format = ">cllll" | |
16 | propertycache = util.propertycache |
|
16 | propertycache = util.propertycache | |
|
17 | filecache = scmutil.filecache | |||
|
18 | ||||
|
19 | class repocache(filecache): | |||
|
20 | """filecache for files in .hg/""" | |||
|
21 | def join(self, obj, fname): | |||
|
22 | return obj._opener.join(fname) | |||
17 |
|
23 | |||
18 | def _finddirs(path): |
|
24 | def _finddirs(path): | |
19 | pos = path.rfind('/') |
|
25 | pos = path.rfind('/') | |
@@ -78,7 +84,7 b' class dirstate(object):' | |||||
78 | f['.'] = '.' # prevents useless util.fspath() invocation |
|
84 | f['.'] = '.' # prevents useless util.fspath() invocation | |
79 | return f |
|
85 | return f | |
80 |
|
86 | |||
81 | @propertycache |
|
87 | @repocache('branch') | |
82 | def _branch(self): |
|
88 | def _branch(self): | |
83 | try: |
|
89 | try: | |
84 | return self._opener.read("branch").strip() or "default" |
|
90 | return self._opener.read("branch").strip() or "default" |
@@ -212,6 +212,13 b' def rollback(server):' | |||||
212 | runcommand(server, ['rollback']) |
|
212 | runcommand(server, ['rollback']) | |
213 | runcommand(server, ['phase', '-r', '.']) |
|
213 | runcommand(server, ['phase', '-r', '.']) | |
214 |
|
214 | |||
|
215 | def branch(server): | |||
|
216 | readchannel(server) | |||
|
217 | runcommand(server, ['branch']) | |||
|
218 | os.system('hg branch foo') | |||
|
219 | runcommand(server, ['branch']) | |||
|
220 | os.system('hg branch default') | |||
|
221 | ||||
215 | if __name__ == '__main__': |
|
222 | if __name__ == '__main__': | |
216 | os.system('hg init') |
|
223 | os.system('hg init') | |
217 |
|
224 | |||
@@ -232,3 +239,4 b" if __name__ == '__main__':" | |||||
232 | check(tagscache) |
|
239 | check(tagscache) | |
233 | check(setphase) |
|
240 | check(setphase) | |
234 | check(rollback) |
|
241 | check(rollback) | |
|
242 | check(branch) |
@@ -145,3 +145,14 b' repository tip rolled back to revision 3' | |||||
145 | working directory now based on revision 3 |
|
145 | working directory now based on revision 3 | |
146 | runcommand phase -r . |
|
146 | runcommand phase -r . | |
147 | 3: public |
|
147 | 3: public | |
|
148 | ||||
|
149 | testing branch: | |||
|
150 | ||||
|
151 | runcommand branch | |||
|
152 | default | |||
|
153 | marked working directory as branch foo | |||
|
154 | (branches are permanent and global, did you want a bookmark?) | |||
|
155 | runcommand branch | |||
|
156 | foo | |||
|
157 | marked working directory as branch default | |||
|
158 | (branches are permanent and global, did you want a bookmark?) |
General Comments 0
You need to be logged in to leave comments.
Login now