Mercurial > hg-stable
changeset 12954:85777aab7e08
merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 08 Nov 2010 17:16:29 -0600 |
parents | 24a1d7ad12a4 (current diff) f6b88f3bcc03 (diff) |
children | 0406682c6905 |
files | |
diffstat | 6 files changed, 91 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sun Nov 07 19:42:42 2010 -0600 +++ b/hgext/mq.py Mon Nov 08 17:16:29 2010 -0600 @@ -1289,6 +1289,9 @@ else: match = cmdutil.matchall(repo) m, a, r, d = repo.status(match=match)[:4] + mm = set(mm) + aa = set(aa) + dd = set(dd) # we might end up with files that were added between # qtip and the dirstate parent, but then changed in the @@ -1296,31 +1299,31 @@ # show up in the added section for x in m: if x not in aa: - mm.append(x) + mm.add(x) # we might end up with files added by the local dirstate that # were deleted by the patch. In this case, they should only # show up in the changed section. for x in a: if x in dd: - del dd[dd.index(x)] - mm.append(x) + dd.remove(x) + mm.add(x) else: - aa.append(x) + aa.add(x) # make sure any files deleted in the local dirstate # are not in the add or change column of the patch forget = [] for x in d + r: if x in aa: - del aa[aa.index(x)] + aa.remove(x) forget.append(x) continue - elif x in mm: - del mm[mm.index(x)] - dd.append(x) - - m = list(set(mm)) - r = list(set(dd)) - a = list(set(aa)) + else: + mm.discard(x) + dd.add(x) + + m = list(mm) + r = list(dd) + a = list(aa) c = [filter(matchfn, l) for l in (m, a, r)] match = cmdutil.matchfiles(repo, set(c[0] + c[1] + c[2])) chunks = patch.diff(repo, patchparent, match=match,
--- a/mercurial/context.py Sun Nov 07 19:42:42 2010 -0600 +++ b/mercurial/context.py Mon Nov 08 17:16:29 2010 -0600 @@ -603,6 +603,9 @@ def __str__(self): return str(self._parents[0]) + "+" + def __repr__(self): + return "<workingctx %s>" % str(self) + def __nonzero__(self): return True @@ -897,6 +900,9 @@ def __str__(self): return "%s@%s" % (self.path(), self._changectx) + def __repr__(self): + return "<workingfilectx %s>" % str(self) + def data(self): return self._repo.wread(self._path) def renamed(self):
--- a/mercurial/graphmod.py Sun Nov 07 19:42:42 2010 -0600 +++ b/mercurial/graphmod.py Mon Nov 08 17:16:29 2010 -0600 @@ -32,7 +32,7 @@ cur = start while cur >= stop: ctx = repo[cur] - parents = [p.rev() for p in ctx.parents() if p.rev() != nullrev] + parents = set([p.rev() for p in ctx.parents() if p.rev() != nullrev]) yield (cur, CHANGESET, ctx, sorted(parents)) cur -= 1 @@ -47,7 +47,7 @@ count = 0 while filerev >= 0 and rev > stop: fctx = repo.filectx(path, fileid=filerev) - parents = [f.linkrev() for f in fctx.parents() if f.path() == path] + parents = set([f.linkrev() for f in fctx.parents() if f.path() == path]) rev = fctx.rev() if rev <= start: yield (rev, CHANGESET, fctx.changectx(), sorted(parents)) @@ -65,7 +65,7 @@ include = set(nodes) for node in nodes: ctx = repo[node] - parents = [p.rev() for p in ctx.parents() if p.node() in include] + parents = set([p.rev() for p in ctx.parents() if p.node() in include]) yield (ctx.rev(), CHANGESET, ctx, sorted(parents)) def colored(dag):
--- a/mercurial/revlog.py Sun Nov 07 19:42:42 2010 -0600 +++ b/mercurial/revlog.py Mon Nov 08 17:16:29 2010 -0600 @@ -607,8 +607,14 @@ some rev in revs, i.e., each revision is *not* considered a descendant of itself. Results are ordered by revision number (a topological sort).""" + first = min(revs) + if first == nullrev: + for i in self: + yield i + return + seen = set(revs) - for i in xrange(min(revs) + 1, len(self)): + for i in xrange(first + 1, len(self)): for x in self.parentrevs(i): if x != nullrev and x in seen: seen.add(i) @@ -869,6 +875,8 @@ return c def descendant(self, start, end): + if start == nullrev: + return True for i in self.descendants(start): if i == end: return True
--- a/tests/test-convert-hg-startrev.t Sun Nov 07 19:42:42 2010 -0600 +++ b/tests/test-convert-hg-startrev.t Mon Nov 08 17:16:29 2010 -0600 @@ -39,13 +39,32 @@ Convert from null revision - $ hg convert --config convert.hg.startrev=null source empty - initializing destination empty repository + $ hg convert --config convert.hg.startrev=null source full + initializing destination full repository scanning source... sorting... converting... + 5 0: add a b + 4 1: add c + 3 2: copy e from a, change b + 2 3: change a + 1 4: merge 2 and 3, copy d from b + 0 5: change a - $ glog empty + $ glog full + o 5 "5: change a" files: a + | + o 4 "4: merge 2 and 3, copy d from b" files: d e + |\ + | o 3 "3: change a" files: a + | | + o | 2 "2: copy e from a, change b" files: b e + | | + o | 1 "1: add c" files: c + |/ + o 0 "0: add a b" files: a b + + $ rm -Rf full Convert from zero revision
--- a/tests/test-glog.t Sun Nov 07 19:42:42 2010 -0600 +++ b/tests/test-glog.t Mon Nov 08 17:16:29 2010 -0600 @@ -887,3 +887,39 @@ | | summary: (33) head | | +Do not crash or produce strange graphs if history is buggy + + $ commit 36 "buggy merge: identical parents" 35 35 + $ hg glog -l5 + @ changeset: 36:95fa8febd08a + | tag: tip + | parent: 35:9159c3644c5e + | parent: 35:9159c3644c5e + | user: test + | date: Thu Jan 01 00:00:36 1970 +0000 + | summary: (36) buggy merge: identical parents + | + o changeset: 35:9159c3644c5e + | user: test + | date: Thu Jan 01 00:00:00 1970 +0000 + | summary: 0 + | + o changeset: 34:fea3ac5810e0 + | parent: 32:d06dffa21a31 + | user: test + | date: Thu Jan 01 00:00:34 1970 +0000 + | summary: (34) head + | + | o changeset: 33:68608f5145f9 + | | parent: 18:1aa84d96232a + | | user: test + | | date: Thu Jan 01 00:00:33 1970 +0000 + | | summary: (33) head + | | + o | changeset: 32:d06dffa21a31 + |\ \ parent: 27:886ed638191b + | | | parent: 31:621d83e11f67 + | | | user: test + | | | date: Thu Jan 01 00:00:32 1970 +0000 + | | | summary: (32) expand + | | |