pushlog: query against unfiltered repo (bug 1286426); r=glandium
authorGregory Szorc <gps@mozilla.com>
Wed, 13 Jul 2016 16:26:50 -0700
changeset 8966 b03458db3e8a5fa53e9a51677a71445a9823ce09
parent 8965 4bbdf0516df1d6258fbf1072052ba81c0b08ac09
child 8967 0bc74c039485df943b4650dc0bf2a858efcf5771
push id1034
push userbmo:gps@mozilla.com
push dateTue, 19 Jul 2016 18:10:24 +0000
reviewersglandium
bugs1286426
pushlog: query against unfiltered repo (bug 1286426); r=glandium By querying against an unfiltered repo, we are able to find hidden changesets referenced by the pushlog. Test changes demonstrate that queries against hidden changesets now yield values. We still have failures for "full=1" queries because we get a filtering error when attempting to retrieve the changectx for a hidden changeset. And, hidden changesets are still being referenced in JSON because we don't check for hidden state in the presentation layer. This will be addressed in subsequent commits. MozReview-Commit-ID: 3i23L9katSB
hgext/pushlog-legacy/pushlog-feed.py
hgext/pushlog-legacy/tests/test-obsolescence.t
--- a/hgext/pushlog-legacy/pushlog-feed.py
+++ b/hgext/pushlog-legacy/pushlog-feed.py
@@ -73,17 +73,20 @@ class PushlogQuery(object):
 
         self.formatversion = 1
         # ID of the last known push in the database.
         self.lastpushid = None
 
     def DoQuery(self):
         """Figure out what the query parameters are, and query the database
         using those parameters."""
-        repo = self.repo
+        # Use an unfiltered repo because query parameters may reference hidden
+        # changesets. Hidden changesets are still in the pushlog. We'll
+        # treat them appropriately at the filter layer.
+        repo = self.repo.unfiltered()
         self.entries = []
         if not self.conn:
             # we didn't get a connection to the database, return empty
             return
         if self.querystart == QueryType.COUNT and not self.userquery and not self.changesetquery:
             # Get entries from self.page, using self.querystart_value as
             # the number of pushes per page.
             try:
--- a/hgext/pushlog-legacy/tests/test-obsolescence.t
+++ b/hgext/pushlog-legacy/tests/test-obsolescence.t
@@ -172,37 +172,139 @@ FIXME Hidden changesets handled properly
       <name>mercurial</name>
     </author>
     <updated>1970-01-01T00:00:00+00:00</updated>
     <content type="text">hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'</content>
    </entry>
   </feed>
   
 
-FIXME Specifying a fromchange with a hidden changeset works
+Specifying a fromchange with a hidden changeset works
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?fromchange=d313a202a85e"
-  404
-  "hidden revision 'd313a202a85e'"
+  200
+  {
+      "3": {
+          "changesets": [
+              "b3641753ee63b166fad7c5f10060b0cbbc8a86b0",
+              "62eebb2f0f00195f9d965f718090c678c4fa414d"
+          ],
+          "date": \d+, (re)
+          "user": "user@example.com"
+      },
+      "4": {
+          "changesets": [
+              "418a63f508062fb2eb9130065c5ddc7908dd5949",
+              "d129109168f0ed985e51b0f86df256acdcfcfe45"
+          ],
+          "date": \d+, (re)
+          "user": "user@example.com"
+      }
+  }
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?fromchange=d313a202a85e&full=1"
-  404
-  "hidden revision 'd313a202a85e'"
+  200
+  {
+      "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 Specifying a tochange with a hidden changeset works
+Specifying a tochange with a hidden changeset works
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?startID=1&tochange=ae13d9da6966"
-  404
-  "hidden revision 'ae13d9da6966'"
+  200
+  {
+      "2": {
+          "changesets": [
+              "ae13d9da6966307c98b60987fb4fedc2e2f29736",
+              "d313a202a85e114000f669c2fcb49ad42376ac04"
+          ],
+          "date": \d+, (re)
+          "user": "user@example.com"
+      }
+  }
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?startID=1&tochange=ae13d9da6966&full=1"
   404
-  "hidden revision 'ae13d9da6966'"
+  "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"
 
-FIXME Specifying a hidden changeset works
+Specifying a hidden changeset works
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?changeset=ae13d9da6966"
-  404
-  "hidden revision 'ae13d9da6966'"
+  200
+  {
+      "2": {
+          "changesets": [
+              "ae13d9da6966307c98b60987fb4fedc2e2f29736",
+              "d313a202a85e114000f669c2fcb49ad42376ac04"
+          ],
+          "date": \d+, (re)
+          "user": "user@example.com"
+      }
+  }
 
   $ httpjson "http://localhost:$HGPORT/json-pushes?changeset=ae13d9da6966&full=1"
   404
-  "hidden revision 'ae13d9da6966'"
+  "hidden revision 'd313a202a85e114000f669c2fcb49ad42376ac04'"