##// END OF EJS Templates
context: add changectx.closesbranch() method...
Brodie Rao -
r16720:e825a89d default
parent child Browse files
Show More
@@ -1349,7 +1349,7 b' def commit(ui, repo, *pats, **opts):'
1349
1349
1350 if not opts.get('close_branch'):
1350 if not opts.get('close_branch'):
1351 for r in parents:
1351 for r in parents:
1352 if r.extra().get('close') and r.branch() == branch:
1352 if r.closesbranch() and r.branch() == branch:
1353 ui.status(_('reopening closed branch head %d\n') % r)
1353 ui.status(_('reopening closed branch head %d\n') % r)
1354
1354
1355 if ui.debugflag:
1355 if ui.debugflag:
@@ -5414,7 +5414,7 b' def summary(ui, repo, **opts):'
5414 t += _(' (merge)')
5414 t += _(' (merge)')
5415 elif branch != parents[0].branch():
5415 elif branch != parents[0].branch():
5416 t += _(' (new branch)')
5416 t += _(' (new branch)')
5417 elif (parents[0].extra().get('close') and
5417 elif (parents[0].closesbranch() and
5418 pnode in repo.branchheads(branch, closed=True)):
5418 pnode in repo.branchheads(branch, closed=True)):
5419 t += _(' (head closed)')
5419 t += _(' (head closed)')
5420 elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]):
5420 elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]):
@@ -186,6 +186,8 b' class changectx(object):'
186 return self._changeset[4]
186 return self._changeset[4]
187 def branch(self):
187 def branch(self):
188 return encoding.tolocal(self._changeset[5].get("branch"))
188 return encoding.tolocal(self._changeset[5].get("branch"))
189 def closesbranch(self):
190 return 'close' in self._changeset[5]
189 def extra(self):
191 def extra(self):
190 return self._changeset[5]
192 return self._changeset[5]
191 def tags(self):
193 def tags(self):
@@ -895,6 +897,8 b' class workingctx(changectx):'
895 return self._clean
897 return self._clean
896 def branch(self):
898 def branch(self):
897 return encoding.tolocal(self._extra['branch'])
899 return encoding.tolocal(self._extra['branch'])
900 def closesbranch(self):
901 return 'close' in self._extra
898 def extra(self):
902 def extra(self):
899 return self._extra
903 return self._extra
900
904
@@ -441,7 +441,7 b' def branches(web, req, tmpl):'
441 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
441 tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems())
442 heads = web.repo.heads()
442 heads = web.repo.heads()
443 parity = paritygen(web.stripecount)
443 parity = paritygen(web.stripecount)
444 sortkey = lambda ctx: ('close' not in ctx.extra(), ctx.rev())
444 sortkey = lambda ctx: (not ctx.closesbranch(), ctx.rev())
445
445
446 def entries(limit, **map):
446 def entries(limit, **map):
447 count = 0
447 count = 0
@@ -511,7 +511,7 b' class localrepository(repo.repository):'
511 '''return the tipmost branch head in heads'''
511 '''return the tipmost branch head in heads'''
512 tip = heads[-1]
512 tip = heads[-1]
513 for h in reversed(heads):
513 for h in reversed(heads):
514 if 'close' not in self.changelog.read(h)[5]:
514 if not self[h].closesbranch():
515 tip = h
515 tip = h
516 break
516 break
517 return tip
517 return tip
@@ -1555,8 +1555,7 b' class localrepository(repo.repository):'
1555 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
1555 fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
1556 bheads = [h for h in bheads if h in fbheads]
1556 bheads = [h for h in bheads if h in fbheads]
1557 if not closed:
1557 if not closed:
1558 bheads = [h for h in bheads if
1558 bheads = [h for h in bheads if not self[h].closesbranch()]
1559 ('close' not in self.changelog.read(h)[5])]
1560 return bheads
1559 return bheads
1561
1560
1562 def branches(self, nodes):
1561 def branches(self, nodes):
@@ -2206,7 +2205,7 b' class localrepository(repo.repository):'
2206 heads = cl.heads()
2205 heads = cl.heads()
2207 dh = len(heads) - len(oldheads)
2206 dh = len(heads) - len(oldheads)
2208 for h in heads:
2207 for h in heads:
2209 if h not in oldheads and 'close' in self[h].extra():
2208 if h not in oldheads and self[h].closesbranch():
2210 dh -= 1
2209 dh -= 1
2211 htext = ""
2210 htext = ""
2212 if dh:
2211 if dh:
@@ -395,7 +395,7 b' def closed(repo, subset, x):'
395 """
395 """
396 # i18n: "closed" is a keyword
396 # i18n: "closed" is a keyword
397 getargs(x, 0, 0, _("closed takes no arguments"))
397 getargs(x, 0, 0, _("closed takes no arguments"))
398 return [r for r in subset if repo[r].extra().get('close')]
398 return [r for r in subset if repo[r].closesbranch()]
399
399
400 def contains(repo, subset, x):
400 def contains(repo, subset, x):
401 """``contains(pattern)``
401 """``contains(pattern)``
General Comments 0
You need to be logged in to leave comments. Login now