piknik

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README | LICENSE

commit a5374b67346bae6a3679d6622b83a65beb137ffc
parent 25d99607828680e77d8a7649bc14f92d35348831
Author: lash <dev@holbrook.no>
Date:   Wed, 19 Apr 2023 19:56:11 +0100

Fix truncate last state in html render, reenable cli state filter

Diffstat:
A.piknik/.tags/UNTAGGED/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 | 0
A.piknik/BACKLOG/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 | 2++
R.piknik/PENDING/0f68c301-74db-49b2-a227-49aab144c9e3 -> .piknik/FINISHED/0f68c301-74db-49b2-a227-49aab144c9e3 | 0
A.piknik/FINISHED/1b02c5d9-4c2b-455d-9874-15c1026b35d9 | 2++
MCHANGELOG | 4++++
Mpiknik/cli/__init__.py | 2++
Mpiknik/cli/show.py | 8++++++--
Mpiknik/render/base.py | 25++++++++++++++++++++++---
Mpiknik/render/html.py | 12+++++++++---
Msetup.cfg | 2+-
10 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/.piknik/.tags/UNTAGGED/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 b/.piknik/.tags/UNTAGGED/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 diff --git a/.piknik/BACKLOG/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 b/.piknik/BACKLOG/5018f938-7610-4ab4-8e80-ac1dc99cc8c3 @@ -0,0 +1 @@ +{"id": "5018f938-7610-4ab4-8e80-ac1dc99cc8c3", "title": "Subcommand context not visible when showing subcommand help page", "assigned": {}, "dependencies": [], "owner": null} +\ No newline at end of file diff --git a/.piknik/PENDING/0f68c301-74db-49b2-a227-49aab144c9e3 b/.piknik/FINISHED/0f68c301-74db-49b2-a227-49aab144c9e3 diff --git a/.piknik/FINISHED/1b02c5d9-4c2b-455d-9874-15c1026b35d9 b/.piknik/FINISHED/1b02c5d9-4c2b-455d-9874-15c1026b35d9 @@ -0,0 +1 @@ +{"id": "1b02c5d9-4c2b-455d-9874-15c1026b35d9", "title": "Render HTML produces duplicate data", "assigned": {}, "dependencies": [], "owner": null} +\ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG @@ -1,3 +1,7 @@ +- 0.3.3 + * Enable state filtering controls from cli + * Make finished issues not visible by default + * Fix last state category truncate in html rendering - 0.3.2 * Add handler for setting pending state * Upgrade shep to handle empty tag directories when transferring (empty) state directories over git diff --git a/piknik/cli/__init__.py b/piknik/cli/__init__.py @@ -11,6 +11,8 @@ class Context: def __init__(self, arg, assembler, mode=0, gpg_home=os.environ.get('GPGHOME')): self.issue_id = arg.issue_id self.files_dir = arg.files_dir + self.show_finished = arg.show_finished + self.show_states = arg.state #self.store_factory = FileStoreFactory(arg.d) store_factory = FileStoreFactory(arg.d) self.signer = None diff --git a/piknik/cli/show.py b/piknik/cli/show.py @@ -79,9 +79,13 @@ def main(): if ctx.issue_id: issues.append(ctx.issue_id) + states_skip = [] + if not ctx.show_finished: + states_skip.append('FINISHED') + if ctx.issue_id == None: accumulator = set_accumulator(ctx, m) - renderer = m.Renderer(ctx.basket, accumulator=accumulator) + renderer = m.Renderer(ctx.basket, accumulator=accumulator, states_include=ctx.show_states, states_skip=states_skip) renderer.apply() issues = reset_accumulator() @@ -91,7 +95,7 @@ def main(): tags = ctx.basket.tags(issue_id) state = ctx.basket.get_state(issue_id) verifier = PGPSigner(home_dir=ctx.gpg_home, skip_verify=False) - renderer = m.Renderer(ctx.basket, wrapper=verifier, accumulator=accumulator) + renderer = m.Renderer(ctx.basket, wrapper=verifier, accumulator=accumulator, states_include=ctx.show_states, states_skip=states_skip) renderer.apply_begin() renderer.apply_issue(state, issue, tags) diff --git a/piknik/render/base.py b/piknik/render/base.py @@ -14,13 +14,31 @@ def stream_accumulator(v, w=sys.stdout): class Renderer: - def __init__(self, basket, accumulator=None, wrapper=None): + def __init__(self, basket, accumulator=None, wrapper=None, states_include=[], states_skip=[]): self.b = basket self.a = accumulator self.w = wrapper if self.w == None: logg.info('no wrapper defined. no message parts will be output') self.render_mode = 0 + self.states = [] + self.__make_state_filter(states_include, states_skip) + + + def __make_state_filter(self, include, skip): + have_include = False + for i in range(len(include)): + include[i] = include[i].upper() + have_include = True + for i in range(len(skip)): + skip[i] = skip[i].upper() + for state in self.b.states(): + if have_include: + if state not in include: + continue + elif state in skip: + continue + self.states.append(state) def add(self, v, accumulator=None): @@ -28,7 +46,7 @@ class Renderer: accumulator = self.a if accumulator != None: if v != None: - accumulator(v) + r = accumulator(v) def apply_envelope_pre(self, state, issue, tags, envelope, accumulator=None): @@ -147,7 +165,8 @@ class Renderer: r = self.apply_begin() self.add(r) - for state in self.b.states(): + #for state in self.b.states(): + for state in self.states: r = self.apply_state_pre(state) self.add(r) r = self.apply_state(state) diff --git a/piknik/render/html.py b/piknik/render/html.py @@ -25,6 +25,7 @@ class Accumulator: #self.envelope_content = None self.envelope = None self.w = w + self.last_v = None self.issues = [] @@ -38,8 +39,10 @@ class Accumulator: self.category.add(self.msg) #self.doc.add(self.msg) self.doc.add(self.category) + if self.last_v != None: + self.category.add(li(self.last_v)) w.write(self.doc.render()) - return + return False v_id = getattr(v, 'id', '') logg.debug('add id {}'.format(v_id)) @@ -68,14 +71,17 @@ class Accumulator: self.envelope.add(v) else: self.doc = v + self.last_v = None + self.last_v = v + return True class Renderer(BaseRenderer): - def __init__(self, basket, accumulator=None, wrapper=None, outdir=None): + def __init__(self, basket, accumulator=None, wrapper=None, outdir=None, states_include=[], states_skip=[]): if accumulator == None: accumulator = Accumulator().add - super(Renderer, self).__init__(basket, accumulator=accumulator, wrapper=wrapper) + super(Renderer, self).__init__(basket, accumulator=accumulator, wrapper=wrapper, states_include=states_include, states_skip=states_skip) self.outdir = outdir diff --git a/setup.cfg b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = piknik -version = 0.3.2 +version = 0.3.3 description = CLI issue tracker author = Louis Holbrook author_email = dev@holbrook.no