<div dir="ltr"><div class="gmail_quote">On Fri, Feb 3, 2012 at 12:36 PM, <span dir="ltr"><<a href="mailto:pierre-yves.david@logilab.fr">pierre-yves.david@logilab.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# HG changeset patch<br>
# User Pierre-Yves David <<a href="mailto:pierre-yves.david@logilab.fr">pierre-yves.david@logilab.fr</a>><br>
# Date 1327941097 -3600<br>
# Node ID 35a9121f3246e05b7a4b83564435d0e3fa346160<br>
# Parent 77bd9605c6da0d58b8f48fe8e5b56c24e34d3146<br>
context: introduce a "shared" property (similar to "immutable")<br>
<br>
This property is True if the changeset should be exchanged:<br></blockquote><div><br></div><div>Shouldn't this be called "shareable" instead? "shared" only</div><div>tells if it's currently shared or not rather than "this cset</div>
<div>should not be shared".</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
draft and public: ctx.shared() == True<br>
secret: ctx.shared() == False<br>
<br>
diff --git a/mercurial/context.py b/mercurial/context.py<br>
--- a/mercurial/context.py<br>
+++ b/mercurial/context.py<br>
@@ -126,10 +126,12 @@ class changectx(object):<br>
return self._repo._phaserev[self._rev]<br>
def phasestr(self):<br>
return phases.phasenames[self.phase()]<br>
def immutable(self):<br>
return self._repo._phaserev[self._rev] <= phases.public<br>
+ def shared(self):<br>
+ return self._repo._phaserev[self._rev] <= phases.draft<br>
def hidden(self):<br>
return self._rev in self._repo.changelog.hiddenrevs<br>
<br>
def parents(self):<br>
"""return contexts for each parent changeset"""<br>
diff --git a/mercurial/discovery.py b/mercurial/discovery.py<br>
--- a/mercurial/discovery.py<br>
+++ b/mercurial/discovery.py<br>
@@ -116,11 +116,11 @@ def findcommonoutgoing(repo, other, only<br>
sets = repo.changelog.findcommonmissing(og.commonheads, onlyheads)<br>
og._common, allmissing = sets<br>
og._missing = missing = []<br>
og.excluded = excluded = []<br>
for node in allmissing:<br>
- if repo[node].phase() >= phases.secret:<br>
+ if not repo[node].shared():<br>
excluded.append(node)<br>
else:<br>
missing.append(node)<br>
if excluded:<br>
# update missing heads<br>
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py<br>
--- a/mercurial/wireproto.py<br>
+++ b/mercurial/wireproto.py<br>
@@ -471,11 +471,11 @@ def listkeys(repo, proto, namespace):<br>
<br>
def lookup(repo, proto, key):<br>
try:<br>
k = encoding.tolocal(key)<br>
c = repo[k]<br>
- if c.phase() == phases.secret:<br>
+ if not c.shared():<br>
raise error.RepoLookupError(_("unknown revision '%s'") % k)<br>
r = c.hex()<br>
success = 1<br>
except Exception, inst:<br>
r = str(inst)<br>
_______________________________________________<br>
Mercurial-devel mailing list<br>
<a href="mailto:Mercurial-devel@selenic.com">Mercurial-devel@selenic.com</a><br>
<a href="http://selenic.com/mailman/listinfo/mercurial-devel" target="_blank">http://selenic.com/mailman/listinfo/mercurial-devel</a><br>
</blockquote></div><br></div>