Show More
@@ -235,6 +235,21 b' class changectx(object):' | |||
|
235 | 235 | return (self.node() in self._repo.obsstore.precursors |
|
236 | 236 | and self.phase() > phases.public) |
|
237 | 237 | |
|
238 | def unstable(self): | |
|
239 | """True if the changeset is not obsolete but it's ancestor are""" | |
|
240 | # We should just compute /(obsolete()::) - obsolete()/ | |
|
241 | # and keep it in a cache. | |
|
242 | # | |
|
243 | # But this naive implementation does not require cache | |
|
244 | if self.phase() <= phases.public: | |
|
245 | return False | |
|
246 | if self.obsolete(): | |
|
247 | return False | |
|
248 | for anc in self.ancestors(): | |
|
249 | if anc.obsolete(): | |
|
250 | return True | |
|
251 | return False | |
|
252 | ||
|
238 | 253 | def _fileinfo(self, path): |
|
239 | 254 | if '_manifest' in self.__dict__: |
|
240 | 255 | try: |
@@ -1317,6 +1317,14 b' def tag(repo, subset, x):' | |||
|
1317 | 1317 | def tagged(repo, subset, x): |
|
1318 | 1318 | return tag(repo, subset, x) |
|
1319 | 1319 | |
|
1320 | def unstable(repo, subset, x): | |
|
1321 | """``unstable()`` | |
|
1322 | Unstable changesets are non-obsolete with obsolete descendants.""" | |
|
1323 | getargs(x, 0, 0, _("obsolete takes no arguments")) | |
|
1324 | unstableset = set(repo.revs('(obsolete()::) - obsolete()')) | |
|
1325 | return [r for r in subset if r in unstableset] | |
|
1326 | ||
|
1327 | ||
|
1320 | 1328 | def user(repo, subset, x): |
|
1321 | 1329 | """``user(string)`` |
|
1322 | 1330 | User name contains string. The match is case-insensitive. |
@@ -1393,6 +1401,7 b' symbols = {' | |||
|
1393 | 1401 | "tag": tag, |
|
1394 | 1402 | "tagged": tagged, |
|
1395 | 1403 | "user": user, |
|
1404 | "unstable": unstable, | |
|
1396 | 1405 | "_list": _list, |
|
1397 | 1406 | } |
|
1398 | 1407 |
@@ -1,4 +1,10 b'' | |||
|
1 | ||
|
1 | $ cat >> $HGRCPATH << EOF | |
|
2 | > [extensions] | |
|
3 | > graphlog= | |
|
4 | > [phases] | |
|
5 | > # public changeset are not obsolete | |
|
6 | > publish=false | |
|
7 | > EOF | |
|
2 | 8 | $ mkcommit() { |
|
3 | 9 | > echo "$1" > "$1" |
|
4 | 10 | > hg add "$1" |
@@ -62,7 +68,7 b' Register two markers with a missing node' | |||
|
62 | 68 | |
|
63 | 69 | Check that graphlog detect that a changeset is obsolete: |
|
64 | 70 | |
|
65 | $ hg --config 'extensions.graphlog=' glog | |
|
71 | $ hg glog | |
|
66 | 72 | @ changeset: 5:5601fb93a350 |
|
67 | 73 | | tag: tip |
|
68 | 74 | | parent: 1:7c3bad9141dc |
@@ -230,6 +236,7 b' On pull' | |||
|
230 | 236 | ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'} |
|
231 | 237 | 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'} |
|
232 | 238 | |
|
239 | ||
|
233 | 240 | On push |
|
234 | 241 | |
|
235 | 242 | $ hg push ../tmpc |
@@ -243,3 +250,68 b' On push' | |||
|
243 | 250 | ca819180edb99ed25ceafb3e9584ac287e240b00 1337133713371337133713371337133713371337 0 {'date': '1338 0', 'user': 'test'} |
|
244 | 251 | 1337133713371337133713371337133713371337 5601fb93a350734d935195fee37f4054c529ff39 0 {'date': '1339 0', 'user': 'test'} |
|
245 | 252 | 2448244824482448244824482448244824482448 1339133913391339133913391339133913391339 0 {'date': '1339 0', 'user': 'test'} |
|
253 | ||
|
254 | detect outgoing obsolete and unstable | |
|
255 | --------------------------------------- | |
|
256 | ||
|
257 | $ hg glog | |
|
258 | o changeset: 5:5601fb93a350 | |
|
259 | | tag: tip | |
|
260 | | parent: 1:7c3bad9141dc | |
|
261 | | user: test | |
|
262 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
263 | | summary: add new_3_c | |
|
264 | | | |
|
265 | | x changeset: 4:ca819180edb9 | |
|
266 | |/ parent: 1:7c3bad9141dc | |
|
267 | | user: test | |
|
268 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
269 | | summary: add new_2_c | |
|
270 | | | |
|
271 | | x changeset: 3:cdbce2fbb163 | |
|
272 | |/ parent: 1:7c3bad9141dc | |
|
273 | | user: test | |
|
274 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
275 | | summary: add new_c | |
|
276 | | | |
|
277 | | o changeset: 2:245bde4270cd | |
|
278 | |/ user: test | |
|
279 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
280 | | summary: add original_c | |
|
281 | | | |
|
282 | o changeset: 1:7c3bad9141dc | |
|
283 | | user: test | |
|
284 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
285 | | summary: add b | |
|
286 | | | |
|
287 | o changeset: 0:1f0dee641bb7 | |
|
288 | user: test | |
|
289 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
290 | summary: add a | |
|
291 | ||
|
292 | $ hg up -q 'desc("new_2_c")' | |
|
293 | $ mkcommit original_d | |
|
294 | $ hg glog -r '::unstable()' | |
|
295 | @ changeset: 6:7878242aeece | |
|
296 | | tag: tip | |
|
297 | | parent: 4:ca819180edb9 | |
|
298 | | user: test | |
|
299 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
300 | | summary: add original_d | |
|
301 | | | |
|
302 | x changeset: 4:ca819180edb9 | |
|
303 | | parent: 1:7c3bad9141dc | |
|
304 | | user: test | |
|
305 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
306 | | summary: add new_2_c | |
|
307 | | | |
|
308 | o changeset: 1:7c3bad9141dc | |
|
309 | | user: test | |
|
310 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
311 | | summary: add b | |
|
312 | | | |
|
313 | o changeset: 0:1f0dee641bb7 | |
|
314 | user: test | |
|
315 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
316 | summary: add a | |
|
317 |
General Comments 0
You need to be logged in to leave comments.
Login now