Patchwork Support exposing hidden changesets

login
register
mail settings
Submitter Gregory Szorc
Date Jan. 3, 2014, 8:43 p.m.
Message ID <62ed6cc0955d5e4ba412.1388781796@77.1.168.192.in-addr.arpa>
Download mbox | patch
Permalink /patch/3259/
State Superseded
Headers show

Comments

Gregory Szorc - Jan. 3, 2014, 8:43 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1388781195 28800
#      Fri Jan 03 12:33:15 2014 -0800
# Node ID 62ed6cc0955d5e4ba4122821bf796092d9e19922
# Parent  c13b99b01008dfd7694e32f803fa679ff0c070d1
Support exposing hidden changesets

hg serve will default to a filtered repo. Some clients may wish to
obtain information about hidden changesets. This patch adds a flag
to allow clients to talk with an unfiltered repo.

It's worth noting that currently the filtered/unfiltered decision is
made at server start time rather than command dispatch time. In the
future, we may wish to patch the command dispatch logic for the server
in Mercurial core so that --hidden on command flags can be honored at
command time.
Gregory Szorc - Jan. 3, 2014, 9:03 p.m.
On 1/3/14, 12:51 PM, Pierre-Yves David wrote:
> On 01/03/2014 12:43 PM, Gregory Szorc wrote:
>> # HG changeset patch
>> # User Gregory Szorc <gregory.szorc@gmail.com>
>> # Date 1388781195 28800
>> #      Fri Jan 03 12:33:15 2014 -0800
>> # Node ID 62ed6cc0955d5e4ba4122821bf796092d9e19922
>> # Parent  c13b99b01008dfd7694e32f803fa679ff0c070d1
>> Support exposing hidden changesets
>>
>> hg serve will default to a filtered repo. Some clients may wish to
>> obtain information about hidden changesets. This patch adds a flag
>> to allow clients to talk with an unfiltered repo.
>>
>> It's worth noting that currently the filtered/unfiltered decision is
>> made at server start time rather than command dispatch time. In the
>> future, we may wish to patch the command dispatch logic for the server
>> in Mercurial core so that --hidden on command flags can be honored at
>
> I'm curious about your use case here. Can you tell us more about it?
>
> Are you aware of the web.views option ? that allow to select a filtering
> level in the repo ?

My use case is I'm building a tool [that I don't want to be GPL 
licensed] that indexes and extracts useful metadata from Mercurial 
repos. A specific feature involves tracking changeset evolution. Thus, I 
need to get access to hidden changesets.

I'm aware of web.views. However, AFAICT that's a separate code path from 
`hg serve`. I'm receptive to patching commandserver.py to do filtering 
at command time. This was the easier patch ;)
Matt Mackall - Jan. 3, 2014, 9:35 p.m.
On Fri, 2014-01-03 at 13:03 -0800, Gregory Szorc wrote:
> On 1/3/14, 12:51 PM, Pierre-Yves David wrote:
> > On 01/03/2014 12:43 PM, Gregory Szorc wrote:
> >> # HG changeset patch
> >> # User Gregory Szorc <gregory.szorc@gmail.com>
> >> # Date 1388781195 28800
> >> #      Fri Jan 03 12:33:15 2014 -0800
> >> # Node ID 62ed6cc0955d5e4ba4122821bf796092d9e19922
> >> # Parent  c13b99b01008dfd7694e32f803fa679ff0c070d1
> >> Support exposing hidden changesets

ContributingChanges, bullet point #1.

> I'm aware of web.views. However, AFAICT that's a separate code path from 
> `hg serve`. I'm receptive to patching commandserver.py to do filtering 
> at command time. This was the easier patch ;)

hg serve --config web.views=

Patch

diff --git a/hglib/client.py b/hglib/client.py
--- a/hglib/client.py
+++ b/hglib/client.py
@@ -36,23 +36,25 @@  class revision(tuple):
         return self[6]
 
 class hgclient(object):
     inputfmt = '>I'
     outputfmt = '>cI'
     outputfmtsize = struct.calcsize(outputfmt)
     retfmt = '>i'
 
-    def __init__(self, path, encoding, configs, connect=True):
+    def __init__(self, path, encoding, configs, connect=True, hidden=False):
         self._args = [hglib.HGPATH, 'serve', '--cmdserver', 'pipe',
                 '--config', 'ui.interactive=True']
         if path:
             self._args += ['-R', path]
         if configs:
             self._args += ['--config'] + configs
+        if hidden:
+            self._args += ['--hidden']
         self._env = {'HGPLAIN': '1'}
         if encoding:
             self._env['HGENCODING'] = encoding
 
         self.server = None
         self._version = None
 
         if connect: