Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 8694:ca8d05e1f1d1
localrepo: set heads and branchheads to be closed=False by default
The heads(...) and branchheads(...) functions will now only return closed
heads when explicitly asked for them. This will cause 'hg merge' to have
better behavior in the presence of a branch that has closed heads when no
explicit rev is passed.
author | John Mulligan <phlogistonjohn@asynchrono.us> |
---|---|
date | Wed, 03 Jun 2009 13:42:55 +0200 |
parents | b6511055d37b |
children | f364cc1d98c4 |
comparison
equal
deleted
inserted
replaced
8693:68e0a55eee6e | 8694:ca8d05e1f1d1 |
---|---|
1111 self.dirstate.add(dest) | 1111 self.dirstate.add(dest) |
1112 self.dirstate.copy(source, dest) | 1112 self.dirstate.copy(source, dest) |
1113 finally: | 1113 finally: |
1114 wlock.release() | 1114 wlock.release() |
1115 | 1115 |
1116 def heads(self, start=None, closed=True): | 1116 def heads(self, start=None, closed=False): |
1117 heads = self.changelog.heads(start) | 1117 heads = self.changelog.heads(start) |
1118 def display(head): | 1118 def display(head): |
1119 if closed: | 1119 if closed: |
1120 return True | 1120 return True |
1121 extras = self.changelog.read(head)[5] | 1121 extras = self.changelog.read(head)[5] |
1122 return ('close' not in extras) | 1122 return ('close' not in extras) |
1123 # sort the output in rev descending order | 1123 # sort the output in rev descending order |
1124 heads = [(-self.changelog.rev(h), h) for h in heads if display(h)] | 1124 heads = [(-self.changelog.rev(h), h) for h in heads if display(h)] |
1125 return [n for (r, n) in sorted(heads)] | 1125 return [n for (r, n) in sorted(heads)] |
1126 | 1126 |
1127 def branchheads(self, branch=None, start=None, closed=True): | 1127 def branchheads(self, branch=None, start=None, closed=False): |
1128 if branch is None: | 1128 if branch is None: |
1129 branch = self[None].branch() | 1129 branch = self[None].branch() |
1130 branches = self.branchmap() | 1130 branches = self.branchmap() |
1131 if branch not in branches: | 1131 if branch not in branches: |
1132 return [] | 1132 return [] |