[PATCH 4 of 5 REVIEW] phases: mark content pushed as public in local repo on push

Matt Mackall mpm at selenic.com
Fri Oct 21 12:14:56 CDT 2011


On Fri, 2011-10-21 at 18:43 +0200, Pierre-Yves David wrote:
> repo.set('heads(%ln or %ln)', common, outg) does not work when common is empty.
> I'm started working a fix for revset but I'll probably need your help.

Ahh, right. We still need some clever way to represent an empty set in a
revset expression so that %l doesn't break with empty lists. A minimal
way would be '(0-0)'. I've queued this as it might be possible to
trigger this with existing code:

diff -r 23ef3e8c9181 mercurial/revset.py
--- a/mercurial/revset.py	Fri Oct 21 12:07:27 2011 +0100
+++ b/mercurial/revset.py	Fri Oct 21 12:09:29 2011 -0500
@@ -1068,6 +1068,8 @@
     '(10 or 11):: and ((this()) or (that()))'
     >>> formatspec('%d:: and not %d::', 10, 20)
     '10:: and not 20::'
+    >>> formatspec('%ld or %ld', [], [1])
+    '(0-0) or (1)'
     >>> formatspec('keyword(%s)', 'foo\\xe9')
     "keyword('foo\\\\xe9')"
     >>> b = lambda: 'default'
@@ -1111,7 +1113,10 @@
                 # a list of some type
                 pos += 1
                 d = expr[pos]
-                lv = ' or '.join(argtype(d, e) for e in args[arg])
+                if args[arg]:
+                    lv = ' or '.join(argtype(d, e) for e in args[arg])
+                else:
+                    lv = '0-0' # a minimal way to represent an empty set
                 ret += '(%s)' % lv
                 arg += 1
             else:


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list