Opened 3 years ago

Closed 3 years ago

#4992 closed change (fixed)

Generate website from the master bookmark [CMS]

Reported by: saroyanm Assignee:
Priority: Unknown Milestone:
Module: Sitescripts Keywords: cms
Cc: juliandoucette, kvas, jsonesen Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29400555/

Description (last modified by jsonesen)

Background

Most of our products are using "master" branch as a "production branch", to be consistent with all other products, we need to also generate the website's content from "master" branch.

What to change

Add an option to generate websites content from provided revision on site repository. Add -r/--rev option (allows specifying revision hashes, branches, tags or bookmarks; see hg help revisions for more detail) to python -m cms.bin.generate_static_pages

How to test

This will likely add a fair amount of test code to ensure stability but the process should be somewhat straight forward. Add bookmarks to the test site repository and diff the two files which contain changes across generation.

Change History (11)

comment:1 Changed 3 years ago by kvas

  • Cc jonsonesen added
  • Description modified (diff)

comment:2 Changed 3 years ago by jsonesen

  • Cc jsonesen added; jonsonesen removed

Perhaps we could change the semantics here to utilize 'bookmark' rather than 'branch' since Mercurial is a dependency of the cms and, while they behave like git branches, Mercurial also has a feature called NamedBranches which do not have a git equivalent and are invoked using hg branch which can be confusing IMO...

Also, of we could start the discussion I think defaulting to master with optional changes to the default by passing -B <bookmark_name> or something.

Last edited 3 years ago by jsonesen (previous) (diff)

comment:3 Changed 3 years ago by kvas

I don't think we want to change the default behavior. The master bookmark is eyeo convention and I don't think we'd do ourself a service by hardcoding this rather specific thing into CMS which, I'd argue, should be as generic as possible.

Our current default is the same as Mercurial default (default branch) and that seems right. We could just provide -r/--rev option that does that same thing as Mercurial's -r/--rev option (allows specifying revision hashes, branches, tags or bookmarks; see hg help revisions for more detail). Seems like this would cover all current and foreseeable use cases and be pretty easy to implement.

comment:4 follow-up: Changed 3 years ago by jsonesen

Sure, -r/--rev is good for me.

Looks like the arg parsing is pretty rudimentary in generate_static_pages.py but should be super tough to add

comment:5 in reply to: ↑ 4 Changed 3 years ago by kvas

Replying to jsonesen:

Looks like the arg parsing is pretty rudimentary in generate_static_pages.py but should be super tough to add

Maybe we add argparse-based proper argument parsing? Seems like that makes more sense going forward than growing our own stuff.

comment:6 Changed 3 years ago by jsonesen

Maybe we add argparse-based proper argument parsing? Seems like that makes more sense going forward than growing our own stuff.

I agree :) Let's do that, it will be useful moving forward as well. Maybe we should still ask Sebastian?

comment:7 Changed 3 years ago by jsonesen

  • Description modified (diff)
  • Summary changed from Generate website from the master branch [CMS] to Generate website from the master bookmark [CMS]
Last edited 3 years ago by jsonesen (previous) (diff)

comment:8 Changed 3 years ago by jsonesen

  • Description modified (diff)

comment:9 Changed 3 years ago by abpbot

A commit referencing this issue has landed:
Issue 4992 - Adds optional revision arg to generate_static_pages

comment:10 Changed 3 years ago by jsonesen

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:11 Changed 3 years ago by jsonesen

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.