--- a/hgext/pushlog-legacy/pushlog-feed.py
+++ b/hgext/pushlog-legacy/pushlog-feed.py
@@ -12,16 +12,17 @@ import mercurial.hgweb.webutil as webuti
from mercurial.hgweb.common import (
ErrorResponse,
HTTP_OK,
paritygen,
)
from mercurial.node import hex, nullid
from mercurial import (
demandimport,
+ error,
templatefilters,
)
sys.path.append(os.path.dirname(__file__))
with demandimport.deactivated():
from parsedatetime import parsedatetime as pdt
@@ -339,17 +340,22 @@ def pushlogFeed(web, req, tmpl):
'url': req.url,
'repo': query.reponame,
'date': dt,
'entries': [],
}
entries = data['entries']
for id, user, date, node in query.entries:
- ctx = web.repo[node]
+ try:
+ ctx = web.repo[node]
+ # Changeset is hidden.
+ except error.FilteredRepoLookupError:
+ pass
+
entries.append({
'node': node,
'date': isotime(date),
'user': xmlescape(user),
'urlbase': query.urlbase,
'url': req.url,
'files': [{'name': fn} for fn in ctx.files()],
})
@@ -409,17 +415,22 @@ def pushlogHTML(web, req, tmpl):
lastid = None
l = []
mergehidden = ""
p = 0
currentpush = None
for id, user, date, node in query.entries:
if isinstance(node, unicode):
node = node.encode('utf-8')
- ctx = web.repo[node]
+
+ try:
+ ctx = web.repo[node]
+ # Changeset is hidden.
+ except error.FilteredRepoLookupError:
+ continue
n = ctx.node()
entry = {"author": ctx.user(),
"desc": ctx.description(),
"files": listfilediffs(tmpl, ctx.files(), n),
"rev": ctx.rev(),
"node": hex(n),
"parents": [c.hex() for c in ctx.parents()],
"tags": nodetagsdict(web.repo, n),
@@ -477,18 +488,23 @@ def pushes_worker(query, repo, full):
# pushes if nodes from the pushlog no longer exist.
if id not in pushes:
pushes[id] = {
'user': user,
'date': date,
'changesets': [],
}
+ try:
+ ctx = repo[node]
+ # Changeset is hidden
+ except error.FilteredRepoLookupError:
+ continue
+
if full:
- ctx = repo[node]
node = {
'node': ctx.hex(),
'author': ctx.user(),
'desc': ctx.description(),
'branch': ctx.branch(),
'parents': [c.hex() for c in ctx.parents()],
'tags': ctx.tags(),
'files': ctx.files()
--- a/hgext/pushlog-legacy/tests/test-obsolescence.t
+++ b/hgext/pushlog-legacy/tests/test-obsolescence.t
@@ -73,20 +73,17 @@ FIXME Hidden changesets should not be ex
"1": {
"changesets": [
"96ee1d7354c4ad7372047672c36a1f561e3a6a4c"
],
"date": \d+, (re)
"user": "user@example.com"
},
"2": {
- "changesets": [
- "ae13d9da6966307c98b60987fb4fedc2e2f29736",
- "d313a202a85e114000f669c2fcb49ad42376ac04"
- ],
+ "changesets": [],
"date": \d+, (re)
"user": "user@example.com"
},
"3": {
"changesets": [
"b3641753ee63b166fad7c5f10060b0cbbc8a86b0",
"62eebb2f0f00195f9d965f718090c678c4fa414d"
],
@@ -99,38 +96,126 @@ FIXME Hidden changesets should not be ex
"d129109168f0ed985e51b0f86df256acdcfcfe45"
],
"date": \d+, (re)
"user": "user@example.com"
}
}
$ httpjson "http://localhost:$HGPORT/json-pushes?version=1&full=1"
- 404
- "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"
+ 200
+ {
+ "1": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "initial",
+ "files": [
+ "foo"
+ ],
+ "node": "96ee1d7354c4ad7372047672c36a1f561e3a6a4c",
+ "parents": [
+ "0000000000000000000000000000000000000000"
+ ],
+ "tags": []
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "2": {
+ "changesets": [],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "3": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file2",
+ "files": [
+ "file2"
+ ],
+ "node": "b3641753ee63b166fad7c5f10060b0cbbc8a86b0",
+ "parents": [
+ "96ee1d7354c4ad7372047672c36a1f561e3a6a4c"
+ ],
+ "tags": []
+ },
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file3",
+ "files": [
+ "file3"
+ ],
+ "node": "62eebb2f0f00195f9d965f718090c678c4fa414d",
+ "parents": [
+ "b3641753ee63b166fad7c5f10060b0cbbc8a86b0"
+ ],
+ "tags": []
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "4": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file0",
+ "files": [
+ "file0"
+ ],
+ "node": "418a63f508062fb2eb9130065c5ddc7908dd5949",
+ "parents": [
+ "62eebb2f0f00195f9d965f718090c678c4fa414d"
+ ],
+ "tags": []
+ },
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file1",
+ "files": [
+ "file1"
+ ],
+ "node": "d129109168f0ed985e51b0f86df256acdcfcfe45",
+ "parents": [
+ "418a63f508062fb2eb9130065c5ddc7908dd5949"
+ ],
+ "tags": [
+ "tip"
+ ]
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ }
+ }
FIXME Hidden changesets should not be exposed to version 2
$ httpjson "http://localhost:$HGPORT/json-pushes?version=2"
200
{
"lastpushid": 4,
"pushes": {
"1": {
"changesets": [
"96ee1d7354c4ad7372047672c36a1f561e3a6a4c"
],
"date": \d+, (re)
"user": "user@example.com"
},
"2": {
- "changesets": [
- "ae13d9da6966307c98b60987fb4fedc2e2f29736",
- "d313a202a85e114000f669c2fcb49ad42376ac04"
- ],
+ "changesets": [],
"date": \d+, (re)
"user": "user@example.com"
},
"3": {
"changesets": [
"b3641753ee63b166fad7c5f10060b0cbbc8a86b0",
"62eebb2f0f00195f9d965f718090c678c4fa414d"
],
@@ -144,41 +229,224 @@ FIXME Hidden changesets should not be ex
],
"date": \d+, (re)
"user": "user@example.com"
}
}
}
$ httpjson "http://localhost:$HGPORT/json-pushes?version=2&full=1"
- 404
- "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"
+ 200
+ {
+ "lastpushid": 4,
+ "pushes": {
+ "1": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "initial",
+ "files": [
+ "foo"
+ ],
+ "node": "96ee1d7354c4ad7372047672c36a1f561e3a6a4c",
+ "parents": [
+ "0000000000000000000000000000000000000000"
+ ],
+ "tags": []
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "2": {
+ "changesets": [],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "3": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file2",
+ "files": [
+ "file2"
+ ],
+ "node": "b3641753ee63b166fad7c5f10060b0cbbc8a86b0",
+ "parents": [
+ "96ee1d7354c4ad7372047672c36a1f561e3a6a4c"
+ ],
+ "tags": []
+ },
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file3",
+ "files": [
+ "file3"
+ ],
+ "node": "62eebb2f0f00195f9d965f718090c678c4fa414d",
+ "parents": [
+ "b3641753ee63b166fad7c5f10060b0cbbc8a86b0"
+ ],
+ "tags": []
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ },
+ "4": {
+ "changesets": [
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file0",
+ "files": [
+ "file0"
+ ],
+ "node": "418a63f508062fb2eb9130065c5ddc7908dd5949",
+ "parents": [
+ "62eebb2f0f00195f9d965f718090c678c4fa414d"
+ ],
+ "tags": []
+ },
+ {
+ "author": "test",
+ "branch": "default",
+ "desc": "file1",
+ "files": [
+ "file1"
+ ],
+ "node": "d129109168f0ed985e51b0f86df256acdcfcfe45",
+ "parents": [
+ "418a63f508062fb2eb9130065c5ddc7908dd5949"
+ ],
+ "tags": [
+ "tip"
+ ]
+ }
+ ],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ }
+ }
+ }
FIXME Hidden changesets handled properly on feed
$ http --no-headers "http://localhost:$HGPORT/atom-pushlog"
- 404
+ 200
<?xml version="1.0" encoding="ascii"?>
<feed xmlns="http://www.w3.org/2005/Atom">
- <!-- Error -->
- <id>http://*:$HGPORT/</id> (glob)
- <link rel="self" href="http://*:$HGPORT/atom-log"/> (glob)
- <link rel="alternate" href="http://*:$HGPORT/"/> (glob)
- <title>Error</title>
- <updated>1970-01-01T00:00:00+00:00</updated>
+ <id>http://*:$HGPORT/pushlog</id> (glob)
+ <link rel="self" href="http://*:$HGPORT/pushlog"/> (glob)
+ <link rel="alternate" href="http://*:$HGPORT/pushloghtml"/> (glob)
+ <title>server Pushlog</title>
+ <updated>*Z</updated> (glob)
+ <entry>
+ <title>Changeset d129109168f0ed985e51b0f86df256acdcfcfe45</title>
+ <id>http://www.selenic.com/mercurial/#changeset-d129109168f0ed985e51b0f86df256acdcfcfe45</id>
+ <link href="http://*:$HGPORT/rev/d129109168f0ed985e51b0f86df256acdcfcfe45"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file1</li></ul>
+ </div>
+ </content>
+ </entry>
+ <entry>
+ <title>Changeset 418a63f508062fb2eb9130065c5ddc7908dd5949</title>
+ <id>http://www.selenic.com/mercurial/#changeset-418a63f508062fb2eb9130065c5ddc7908dd5949</id>
+ <link href="http://*:$HGPORT/rev/418a63f508062fb2eb9130065c5ddc7908dd5949"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file0</li></ul>
+ </div>
+ </content>
+ </entry>
+ <entry>
+ <title>Changeset 62eebb2f0f00195f9d965f718090c678c4fa414d</title>
+ <id>http://www.selenic.com/mercurial/#changeset-62eebb2f0f00195f9d965f718090c678c4fa414d</id>
+ <link href="http://*:$HGPORT/rev/62eebb2f0f00195f9d965f718090c678c4fa414d"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file3</li></ul>
+ </div>
+ </content>
+ </entry>
<entry>
- <title>Error</title>
- <id>https://mercurial-scm.org/#error</id>
+ <title>Changeset b3641753ee63b166fad7c5f10060b0cbbc8a86b0</title>
+ <id>http://www.selenic.com/mercurial/#changeset-b3641753ee63b166fad7c5f10060b0cbbc8a86b0</id>
+ <link href="http://*:$HGPORT/rev/b3641753ee63b166fad7c5f10060b0cbbc8a86b0"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file2</li></ul>
+ </div>
+ </content>
+ </entry>
+ <entry>
+ <title>Changeset d313a202a85e114000f669c2fcb49ad42376ac04</title>
+ <id>http://www.selenic.com/mercurial/#changeset-d313a202a85e114000f669c2fcb49ad42376ac04</id>
+ <link href="http://*:$HGPORT/rev/d313a202a85e114000f669c2fcb49ad42376ac04"/> (glob)
+ <updated>*Z</updated> (glob)
<author>
- <name>mercurial</name>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file2</li></ul>
+ </div>
+ </content>
+ </entry>
+ <entry>
+ <title>Changeset ae13d9da6966307c98b60987fb4fedc2e2f29736</title>
+ <id>http://www.selenic.com/mercurial/#changeset-ae13d9da6966307c98b60987fb4fedc2e2f29736</id>
+ <link href="http://*:$HGPORT/rev/ae13d9da6966307c98b60987fb4fedc2e2f29736"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
</author>
- <updated>1970-01-01T00:00:00+00:00</updated>
- <content type="text">hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'</content>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">file2</li></ul>
+ </div>
+ </content>
</entry>
+ <entry>
+ <title>Changeset 96ee1d7354c4ad7372047672c36a1f561e3a6a4c</title>
+ <id>http://www.selenic.com/mercurial/#changeset-96ee1d7354c4ad7372047672c36a1f561e3a6a4c</id>
+ <link href="*:$HGPORT/rev/96ee1d7354c4ad7372047672c36a1f561e3a6a4c"/> (glob)
+ <updated>*Z</updated> (glob)
+ <author>
+ <name>user@example.com</name>
+ </author>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <ul class="filelist"><li class="file">foo</li></ul>
+ </div>
+ </content>
+ </entry>
+
</feed>
Specifying a fromchange with a hidden changeset works
$ httpjson "http://localhost:$HGPORT/json-pushes?fromchange=d313a202a85e"
200
{
@@ -272,39 +540,45 @@ Specifying a fromchange with a hidden ch
}
Specifying a tochange with a hidden changeset works
$ httpjson "http://localhost:$HGPORT/json-pushes?startID=1&tochange=ae13d9da6966"
200
{
"2": {
- "changesets": [
- "ae13d9da6966307c98b60987fb4fedc2e2f29736",
- "d313a202a85e114000f669c2fcb49ad42376ac04"
- ],
+ "changesets": [],
"date": \d+, (re)
"user": "user@example.com"
}
}
$ httpjson "http://localhost:$HGPORT/json-pushes?startID=1&tochange=ae13d9da6966&full=1"
- 404
- "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"
+ 200
+ {
+ "2": {
+ "changesets": [],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ }
+ }
Specifying a hidden changeset works
$ httpjson "http://localhost:$HGPORT/json-pushes?changeset=ae13d9da6966"
200
{
"2": {
- "changesets": [
- "ae13d9da6966307c98b60987fb4fedc2e2f29736",
- "d313a202a85e114000f669c2fcb49ad42376ac04"
- ],
+ "changesets": [],
"date": \d+, (re)
"user": "user@example.com"
}
}
$ httpjson "http://localhost:$HGPORT/json-pushes?changeset=ae13d9da6966&full=1"
- 404
- "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"
+ 200
+ {
+ "2": {
+ "changesets": [],
+ "date": \d+, (re)
+ "user": "user@example.com"
+ }
+ }