Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/branchmap.py @ 20245:4edd179fefb8
help: branch names primarily denote the tipmost unclosed branch head
Was the behavior correct and the description wrong so it should be updated as
in this patch? Or should the code work as the documentation says?
Both ways could make some sense ... but none of them are obvious in all cases.
One place where it currently cause problems is when the current revision has
another branch head that is closer to tip but closed. 'hg rebase' refuses to
rebase to that as it only see the tip-most unclosed branch head which is the
current revision.
/me kind of likes named branches, but no so much how branch closing works ...
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 21 Nov 2013 15:17:18 -0500 |
parents | d5d25e541637 |
children | 586ec8fe1c3c |
comparison
equal
deleted
inserted
replaced
20244:47d0843647d1 | 20245:4edd179fefb8 |
---|---|
165 and (self.filteredhash == self._hashfiltered(repo))) | 165 and (self.filteredhash == self._hashfiltered(repo))) |
166 except IndexError: | 166 except IndexError: |
167 return False | 167 return False |
168 | 168 |
169 def _branchtip(self, heads): | 169 def _branchtip(self, heads): |
170 '''Return tuple with last open head in heads and false, | |
171 otherwise return last closed head and true.''' | |
170 tip = heads[-1] | 172 tip = heads[-1] |
171 closed = True | 173 closed = True |
172 for h in reversed(heads): | 174 for h in reversed(heads): |
173 if h not in self._closednodes: | 175 if h not in self._closednodes: |
174 tip = h | 176 tip = h |
175 closed = False | 177 closed = False |
176 break | 178 break |
177 return tip, closed | 179 return tip, closed |
178 | 180 |
179 def branchtip(self, branch): | 181 def branchtip(self, branch): |
182 '''Return the tipmost open head on branch head, otherwise return the | |
183 tipmost closed head on branch. | |
184 Raise KeyError for unknown branch.''' | |
180 return self._branchtip(self[branch])[0] | 185 return self._branchtip(self[branch])[0] |
181 | 186 |
182 def branchheads(self, branch, closed=False): | 187 def branchheads(self, branch, closed=False): |
183 heads = self[branch] | 188 heads = self[branch] |
184 if not closed: | 189 if not closed: |