Issue #149: Showing pullrequest failed : revision None does not exists (conservancy/kallithea)

2015-07-28 Thread Mathieu Clabaut
New issue 149: Showing pullrequest failed : revision None does not exists
https://bitbucket.org/conservancy/kallithea/issues/149/showing-pullrequest-failed-revision-none

Mathieu Clabaut:

Showing a pull request between tip and branch 1.0 leads to the following stack 
trace
```
2015-07-28 12:13:52.448 INFO  [kallithea.lib.auth] user 
AuthUser('id:2[clabaut] auth:True') authenticated with regular auth @ 
PullrequestsController:show
Error - class 'kallithea.lib.vcs.exceptions.ChangesetDoesNotExistError': 
Revision None does not exist for MercurialRepository at /tmp_dsk/attic2
URL: http://127.0.0.1:5000/attic2/pull-request/3/_/1.0
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/WebError-0.10.3-py2.7.egg/weberror/errormiddleware.py',
 line 162 in __call__
  app_iter = self.application(environ, sr_checker)
File 
'/home/clabaut/contrib/kallithea/kallithea/lib/middleware/sessionmiddleware.py',
 line 62 in __call__
  return self.wrap_app(environ, session_start_response)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/middleware.py',
 line 131 in __call__
  response = self.app(environ, start_response)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/wsgiapp.py',
 line 107 in __call__
  response = self.dispatch(controller, environ, start_response)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/wsgiapp.py',
 line 312 in dispatch
  return controller(environ, start_response)
File '/home/clabaut/contrib/kallithea/kallithea/lib/base.py', line 397 in 
__call__
  return WSGIController.__call__(self, environ, start_response)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/controllers/core.py',
 line 211 in __call__
  response = self._dispatch_call()
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/controllers/core.py',
 line 162 in _dispatch_call
  response = self._inspect_call(func)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/controllers/core.py',
 line 105 in _inspect_call
  result = self._perform_call(func, args)
File 
'/home/clabaut/.virtualenvs/kallithea/lib/python2.7/site-packages/pylons/controllers/core.py',
 line 57 in _perform_call
  return func(**args)
File 'string', line 2 in show
File '/home/clabaut/contrib/kallithea/kallithea/lib/auth.py', line 763 in 
__wrapper
  return func(*fargs, **fkwargs)
File 'string', line 2 in show
File '/home/clabaut/contrib/kallithea/kallithea/lib/auth.py', line 810 in 
__wrapper
  return func(*fargs, **fkwargs)
File '/home/clabaut/contrib/kallithea/kallithea/controllers/pullrequests.py', 
line 646 in show
  context=line_context)
File 
'/home/clabaut/contrib/kallithea/kallithea/lib/vcs/backends/hg/repository.py', 
line 258 in get_diff
  self.get_changeset(rev1)
File 
'/home/clabaut/contrib/kallithea/kallithea/lib/vcs/backends/hg/repository.py', 
line 500 in get_changeset
  revision = self._get_revision(revision)
File 
'/home/clabaut/contrib/kallithea/kallithea/lib/vcs/backends/hg/repository.py', 
line 429 in _get_revision
  raise ChangesetDoesNotExistError(msg)
ChangesetDoesNotExistError: Revision None does not exist for 
MercurialRepository at /tmp_dsk/attic2


CGI Variables
-
  CONTENT_TYPE: '; charset=utf-8'
  HTTP_ACCEPT: 
'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
  HTTP_ACCEPT_ENCODING: 'gzip, deflate, sdch'
  HTTP_ACCEPT_LANGUAGE: 'fr'
  HTTP_CONNECTION: 'keep-alive'
  HTTP_COOKIE: 
'kallithea=96a5ae7d18ac6b7e0374375a2c29c27e2e4a4875827e6a9df6064ce9b791efa8f968700a'
  HTTP_HOST: '127.0.0.1:5000'
  HTTP_REFERER: 'http://127.0.0.1:5000/attic2/pull-request'
  HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, 
like Gecko) Chrome/43.0.2357.134 Safari/537.36'
  PATH_INFO: '/attic2/pull-request/3/_/1.0'
  REMOTE_ADDR: '127.0.0.1'
  REQUEST_METHOD: 'GET'
  SERVER_NAME: 'localhost.localdomain'
  SERVER_PORT: '5000'
  SERVER_PROTOCOL: 'HTTP/1.1'
  SERVER_SOFTWARE: 'waitress'


WSGI Variables
--
  application: 
kallithea.lib.middleware.sessionmiddleware.SecureSessionMiddleware object at 
0x7f6ef6ee3490
  beaker.get_session: bound method SecureSessionMiddleware._get_session of 
kallithea.lib.middleware.sessionmiddleware.SecureSessionMiddleware object at 
0x7f6ef6ee3490
  beaker.session: {'_authentication_token': 
'246234190613261990002291801955806687529', 'authuser': {'username': u'clabaut', 
'is_authenticated': True, 'user_id': 2}, '_accessed_time': 1438078432.407353, 
'_creation_time': 1435673266.713354}
  paste.registry: paste.registry.Registry object at 0x7f6edef55710
  paste.throw_errors: True
  pylons.action_method: bound method PullrequestsController.show of 
kallithea.controllers.pullrequests.PullrequestsController object at 
0x7f6edefe6110
  pylons.controller: kallithea.controllers.pullrequests.PullrequestsController 
object at 0x7f6edefe6110
  

[PATCH 1 of 6] graph: show obsolete changesets with an 'X'

2015-07-28 Thread Andrew Shadura
# HG changeset patch
# User Sean Farley sean.michael.far...@gmail.com
# Date 1404884154 18000
#  Wed Jul 09 00:35:54 2014 -0500
# Node ID 011e77e80ae34ba9a19b8591c78959feee5934b9
# Parent  82faecc2132459bf0ba2717f2178ce6b3672e268
graph: show obsolete changesets with an 'X'

diff --git a/kallithea/lib/graphmod.py b/kallithea/lib/graphmod.py
--- a/kallithea/lib/graphmod.py
+++ b/kallithea/lib/graphmod.py
@@ -150,5 +150,6 @@ def _colored(repo, dag):
 
 # Yield and move on
 closing = int(repo[rev].closesbranch)
-yield ((col, color), edges, closing)
+obsolete = int(repo[rev].obsolete)
+yield ((col, color), edges, closing, obsolete)
 row = nextrow
diff --git a/kallithea/lib/vcs/backends/base.py 
b/kallithea/lib/vcs/backends/base.py
--- a/kallithea/lib/vcs/backends/base.py
+++ b/kallithea/lib/vcs/backends/base.py
@@ -667,6 +667,10 @@ class BaseChangeset(object):
 def closesbranch(self):
 return False
 
+@LazyProperty
+def obsolete(self):
+return False
+
 class BaseWorkdir(object):
 
 Working directory representation of single repository.
diff --git a/kallithea/lib/vcs/backends/hg/changeset.py 
b/kallithea/lib/vcs/backends/hg/changeset.py
--- a/kallithea/lib/vcs/backends/hg/changeset.py
+++ b/kallithea/lib/vcs/backends/hg/changeset.py
@@ -43,6 +43,10 @@ class MercurialChangeset(BaseChangeset):
 return  self._ctx.closesbranch()
 
 @LazyProperty
+def obsolete(self):
+return  self._ctx.obsolete()
+
+@LazyProperty
 def bookmarks(self):
 return map(safe_unicode, self._ctx.bookmarks())
 
diff --git a/kallithea/public/js/graph.js b/kallithea/public/js/graph.js
--- a/kallithea/public/js/graph.js
+++ b/kallithea/public/js/graph.js
@@ -105,6 +105,7 @@ function BranchRenderer(canvas_id, conte
node = cur[0];
in_l = cur[1];
closing = cur[2];
+   obsolete_node = cur[3];
 
var rowY = row.offsetTop + row.offsetHeight/2;
var nextY = (next == null) ? rowY + row.offsetHeight/2 
: next.offsetTop + next.offsetHeight/2;
@@ -178,6 +179,19 @@ function BranchRenderer(canvas_id, conte
x = Math.floor(base_x - box_size * column);

this.setColor(color, 0.25, 0.75);
+
+
+   r = this.dot_radius
+   if (obsolete_node)
+   {
+   this.ctx.beginPath();
+   this.ctx.moveTo(x - this.close_x, rowY - 
this.close_y - 3);
+   this.ctx.lineTo(x - this.close_x + 
2*this.close_x, rowY - this.close_y + 4*this.close_y - 1);
+   this.ctx.moveTo(x - this.close_x, rowY - 
this.close_y + 4*this.close_y - 1);
+   this.ctx.lineTo(x - this.close_x + 
2*this.close_x, rowY - this.close_y - 3);
+   this.ctx.stroke();
+   r -= 0.5
+   }
if (closing)
{
this.ctx.fillRect(x - this.close_x, rowY - 
this.close_y, 2*this.close_x, 2*this.close_y);
@@ -185,7 +199,7 @@ function BranchRenderer(canvas_id, conte
else
{
this.ctx.beginPath();
-   this.ctx.arc(x, rowY, this.dot_radius, 0, 
Math.PI * 2, true);
+   this.ctx.arc(x, rowY, r, 0, Math.PI * 2, true);
this.ctx.fill();
}
 
___
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general


[PATCH 0 of 6] Evolve support patches from Sean

2015-07-28 Thread Andrew Shadura
Hello everyone,

I'm submitting the some of the patches Sean Farley wrote a while ago to 
support changeset obsoletion and evolution. I've been using them for a 
while and they don't seem to break stuff. There were more patches, but 
some of them didn't work always right and also seem obsolete with the 
latest versions of Mercurial.

-- 
Cheers,
  Andrew
___
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general


[PATCH 4 of 6] templates/changeset: display successor changesets

2015-07-28 Thread Andrew Shadura
# HG changeset patch
# User Sean Farley sean.michael.far...@gmail.com
# Date 1406668550 18000
#  Tue Jul 29 16:15:50 2014 -0500
# Node ID 28e4930d9bc2593c6e2b43629dc8b1f9122a7a5e
# Parent  b08991c9389cbc64e5145b71629079fa7059fa6c
templates/changeset: display successor changesets

diff --git a/kallithea/templates/changeset/changeset.html 
b/kallithea/templates/changeset/changeset.html
--- a/kallithea/templates/changeset/changeset.html
+++ b/kallithea/templates/changeset/changeset.html
@@ -129,6 +129,21 @@
${_('Transplanted from:')} 
${h.link_to(h.short_id(rev),h.url('changeset_home',repo_name=c.repo_name,revision=rev))}
  /div
  %endif
+
+ % if hasattr(c.changeset, 'successors') and 
c.changeset.successors:
+ div class='successors'
+   span class='successors_header'${_('Replaced by:')} 
/span
+   % for i, s in enumerate(c.changeset.successors):
+   %
+   comma = 
+   if i != len(c.changeset.successors)-1:
+ comma = , 
+   %
+ a class='successors_hash' 
href=${h.url('changeset_home',repo_name=c.repo_name, 
revision=s)}${s}/a${comma}
+   % endfor
+ /div
+ % endif
+
  div 
class=message${h.urlify_commit(c.changeset.message, c.repo_name)}/div
 /div
 /div
___
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general


[PATCH 2 of 6] graph: draw edges to obsolete changesets as dashed

2015-07-28 Thread Andrew Shadura
# HG changeset patch
# User Sean Farley sean.michael.far...@gmail.com
# Date 1404932959 18000
#  Wed Jul 09 14:09:19 2014 -0500
# Node ID 1d08fb9cd850269f7f771e54f3e9496d49fcb102
# Parent  011e77e80ae34ba9a19b8591c78959feee5934b9
graph: draw edges to obsolete changesets as dashed

diff --git a/kallithea/lib/graphmod.py b/kallithea/lib/graphmod.py
--- a/kallithea/lib/graphmod.py
+++ b/kallithea/lib/graphmod.py
@@ -103,6 +103,7 @@ def _colored(repo, dag):
 
 row = []
 colors = {}
+obs = {}
 newcolor = 1
 
 for (rev, dagparents) in dag:
@@ -111,6 +112,7 @@ def _colored(repo, dag):
 if rev not in row:
 row.append(rev)  # new head
 colors[rev] = newcolor
+obs[rev] = int(repo[rev].obsolete)
 newcolor += 1
 
 col = row.index(rev)
@@ -126,12 +128,14 @@ def _colored(repo, dag):
 nextrow.append(r)
 else:
 colors.pop(r)
+obs.pop(r)
 
 # Set colors for the parents
 color = colors.pop(rev)
 if addparents:
 b = branch(rev)
 for p in reversed(addparents):
+obs[p] = int(repo[p].obsolete)
 if b and branch(abs(p)) == b:
 colors[p] = color
 b = None
@@ -143,10 +147,10 @@ def _colored(repo, dag):
 edges = []
 for ecol, ep in enumerate(row):
 if ep in nextrow:
-edges.append((ecol, nextrow.index(ep), colors[ep]))
+edges.append((ecol, nextrow.index(ep), colors[ep], obs[ep]))
 elif ep == rev:
 for p in dagparents:
-edges.append((ecol, nextrow.index(p), colors[p]))
+edges.append((ecol, nextrow.index(p), colors[p], obs[p]))
 
 # Yield and move on
 closing = int(repo[rev].closesbranch)
diff --git a/kallithea/public/js/graph.js b/kallithea/public/js/graph.js
--- a/kallithea/public/js/graph.js
+++ b/kallithea/public/js/graph.js
@@ -115,6 +115,7 @@ function BranchRenderer(canvas_id, conte
start = line[0];
end = line[1];
color = line[2];
+   obsolete_line = line[3];

x = Math.floor(base_x - box_size * start);
 
@@ -159,6 +160,11 @@ function BranchRenderer(canvas_id, conte

this.ctx.lineWidth=this.line_width;
this.ctx.beginPath();
+   if (obsolete_line)
+   {
+   this.ctx.setLineDash([5]);
+   }
+   this.ctx.beginPath();
this.ctx.moveTo(x, rowY);
if (start == end)
{
@@ -168,9 +174,14 @@ function BranchRenderer(canvas_id, conte
{
var x2 = Math.floor(base_x - box_size * 
end);
var ymid = (rowY+nextY) / 2;
+   if (obsolete_node)
+   {
+   this.ctx.setLineDash([5]);
+   }
this.ctx.bezierCurveTo 
(x,ymid,x2,ymid,x2,nextY);
}
this.ctx.stroke();
+   this.ctx.setLineDash([]); // reset the dashed 
line, if any
}

column = node[0];
___
kallithea-general mailing list
kallithea-general@sfconservancy.org
http://lists.sfconservancy.org/mailman/listinfo/kallithea-general