success, changed = udoc.share(form.cleaned_data['message'])
if not success:
- return response.EntityConflict().django_response({})
+ return response.EntityConflict().django_response({
+ 'reason': 'merge-failure',
+ })
if not changed:
return response.SuccessNoContent().django_response()
return (a.branch() == self._changectx.branch())
def has_children(self):
- return bool( self._library._hgrepo.changelog.children(self.hgrev()) )
+ children = self._library._hgrepo.changelog.children(self.hgrev())
+ print "C:", children, bool(children)
+ return bool(children)
def merge_with(self, other, user, message):
lock = self._library.lock(True)
return (True, False)
if self._revision.has_children():
+ print 'Update failed: has children.'
# can't update non-latest revision
return (False, False)
sv = self.shared()
-
- if not sv.ancestorof(self) and not self.parentof(sv):
- return self._revision.merge_with(sv._revision, user=user)
- return (False, False)
+ if self.parentof(sv):
+ return (True, False)
+
+ if sv.ancestorof(self):
+ return (True, False)
+
+
+ return self._revision.merge_with(sv._revision, user=user)
finally:
lock.release()