Closed Bug 1115188 Opened 11 years ago Closed 10 years ago

firefoxtree should recognised fxheads from shared repositories

Categories

(Developer Services :: Mercurial: firefoxtree, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mossop, Unassigned)

References

Details

(Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/4249] )

Attachments

(11 files)

40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
40 bytes, text/x-review-board-request
smacleod
: review+
Details
If I have a unified repo "foo" where firefoxtree knows all the fxheads and I "hg share foo bar" then firefoxtree should also know the fxheads when in "bar". It does not though.
This is definitely a bug. I could hack this into submission. But, the solution would be a bit fragile and may break other extensions. Mercurial 3.3 is introducing a proper API for creating names attached to commits. It is technically superior to the localtags foo I'm building on top of now. I'm inclined to ignore this bug until firefoxtree is ported to the Mercurial 3.3 API. Mercurial 3.3 should be released on Feb 1. For now, hack around it by running `hg pull` in every shared clone.
Whiteboard: [kanban:engops:https://mozilla.kanbanize.com/ctrl_board/6/4249]
(In reply to Gregory Szorc [:gps] from comment #1) > I'm inclined to ignore this bug until firefoxtree is ported to the Mercurial > 3.3 API. Mercurial 3.3 should be released on Feb 1. I wonder if this is actionable now?
It is actionable. I have an incomplete patch series locally. Also, ~20% of our staff are still on 3.2 or older, according to the developer survey from a few weeks ago. While we try to maintain compatibility with the previous 4 released Mercurial versions, I'm fine with dropping 3.2 for firefoxtree now. (We'll drop 3.2 after 3.6 is released Nov 1 anyway.) I almost certainly won't have time to look at this for the next few days - finishing up end of quarter foo.
firefoxtree: store firefox tree labels in a dedicated file; r?smacleod Mercurial 3.3 has a "namespaces" API that allows namespaced labels to be attached to Mercurial changesets. This API is a better version of the "local tags" API, which firefoxtree is currently using. This patch starts the series of converting firefoxtree to use the namespaces API. We start the process by creating a standalone file that holds firefox tree node mappings. The namespaces API doesn't do I/O for us, so we have to roll some minimal code. The .hg/firefoxtrees file is now written and read from when the repository is loaded. It is currently a shadow copy of tags being written to local tags. We will eventually transition off local tags towards this new file.
Attachment #8697861 - Flags: review?(smacleod)
firefoxtree: obtain firefox tree tags from the firefoxtrees file; r?smacleod get_firefoxtrees() is our internal API for iterating over Firefox tree labels stored in the repository. It is currently getting information from localtags. Since we are transitioning away from local tags, grab the information from the local file instead. This change will result in apparent data loss until the next `hg pull`. This regression will be addressed in subsequent changes.
Attachment #8697862 - Flags: review?(smacleod)
firefoxtree: define fxtrees namespace; r?smacleod
Attachment #8697863 - Flags: review?(smacleod)
firefoxtree: update firefoxtrees file when processing wire protocol command; r?smacleod Previously, we didn't update the refs when the wire protocol command was processed. Change that. This does result in redundant output in `hg log`. This will be fixed in a subsequent patch.
Attachment #8697864 - Flags: review?(smacleod)
firefoxtree: read old tags using internal API; r?smacleod When processing tree nodes via the wire protocol command, use the values from the firefoxtrees file instead of from the local tags file. This reinforces the firefoxtrees file being the canonical location of this data.
Attachment #8697865 - Flags: review?(smacleod)
firefoxtree: move localtags sanitization into writefirefoxtrees; r?smacleod We have a function for writing firefoxtrees data. This code should live there.
Attachment #8697866 - Flags: review?(smacleod)
firefoxtree: implement `hg fxheads` using new APIs; r?smacleod Previously, we were printing tags. This was a holdover from the days before {fxheads} was available. It has the unfortunate side-effect of including non-tree tags in the output. Change the template to use {fxheads} so only Firefox tree labels are shown. As part of this, limit to one output per unique node. Otherwise we will print the same changeset twice if it has multiple fxtree labels defined.
Attachment #8697867 - Flags: review?(smacleod)
firefoxtree: don't test contents of localtags file; r?smacleod We're not testing localtags anywhere else. Remove the test. This paves the way for easier removal of tag writing from the extension.
Attachment #8697868 - Flags: review?(smacleod)
firefoxtree: don't write local tags; r?smacleod The namespaces API is the new preferred way to record topical labels. Stop writing local tags for firefoxtree labels. As the test changes demonstrate, our redundant labels in `hg log` are now gone.
Attachment #8697869 - Flags: review?(smacleod)
firefoxtree: prune entries from localtags file; r?smacleod We no longer write to this file. We need to prune existing entries from it or they may interfere with existing use.
Attachment #8697870 - Flags: review?(smacleod)
firefoxtree: automatically share tree labels with `hg share` (bug 1115188); r?smacleod Repositories created with `hg share` need to obtain certain repository data from the shared source repo, otherwise each share has its own state. For firefoxtree, it makes sense for the tree labels to be shared across all shared repos. This commit implements that.
Attachment #8697871 - Flags: review?(smacleod)
Comment on attachment 8697861 [details] MozReview Request: firefoxtree: store firefox tree labels in a dedicated file; r?smacleod https://reviewboard.mozilla.org/r/27729/#review25253
Attachment #8697861 - Flags: review?(smacleod) → review+
Attachment #8697862 - Flags: review?(smacleod) → review+
Comment on attachment 8697862 [details] MozReview Request: firefoxtree: obtain firefox tree tags from the firefoxtrees file; r?smacleod https://reviewboard.mozilla.org/r/27731/#review25255
Attachment #8697863 - Flags: review?(smacleod) → review+
Comment on attachment 8697863 [details] MozReview Request: firefoxtree: define fxtrees namespace; r?smacleod https://reviewboard.mozilla.org/r/27733/#review25257 ::: hgext/firefoxtree/__init__.py:481 (Diff revision 1) > + def listnames(r): > + return r.firefoxtrees.keys() > + def namemap(r, name): > + node = r.firefoxtrees.get(name) > + if node: > + return [node] > + return [] > + def nodemap(r, node): blank between these please ::: hgext/firefoxtree/__init__.py:492 (Diff revision 1) > + n = namespaces.namespace('fxtrees', 'fxtree', I'm not a fan of relying on kwarg position (`templatename`, in this case). Can we please call it out explicitly `templatename='fxtree'`?
Comment on attachment 8697864 [details] MozReview Request: firefoxtree: update firefoxtrees file when processing wire protocol command; r?smacleod https://reviewboard.mozilla.org/r/27735/#review25259
Attachment #8697864 - Flags: review?(smacleod) → review+
Comment on attachment 8697865 [details] MozReview Request: firefoxtree: read old tags using internal API; r?smacleod https://reviewboard.mozilla.org/r/27737/#review25261
Attachment #8697865 - Flags: review?(smacleod) → review+
Comment on attachment 8697866 [details] MozReview Request: firefoxtree: move localtags sanitization into writefirefoxtrees; r?smacleod https://reviewboard.mozilla.org/r/27739/#review25263
Attachment #8697866 - Flags: review?(smacleod) → review+
Comment on attachment 8697867 [details] MozReview Request: firefoxtree: implement `hg fxheads` using new APIs; r?smacleod https://reviewboard.mozilla.org/r/27741/#review25265
Attachment #8697867 - Flags: review?(smacleod) → review+
Comment on attachment 8697868 [details] MozReview Request: firefoxtree: don't test contents of localtags file; r?smacleod https://reviewboard.mozilla.org/r/27743/#review25267
Attachment #8697868 - Flags: review?(smacleod) → review+
Comment on attachment 8697869 [details] MozReview Request: firefoxtree: don't write local tags; r?smacleod https://reviewboard.mozilla.org/r/27745/#review25269
Attachment #8697869 - Flags: review?(smacleod) → review+
Comment on attachment 8697870 [details] MozReview Request: firefoxtree: prune entries from localtags file; r?smacleod https://reviewboard.mozilla.org/r/27747/#review25271 ::: hgext/firefoxtree/__init__.py:196 (Diff revision 1) > + tree, uri = resolve_trees_to_uris([tag])[0] Would it be worth migrating anything with a uri to the new namespace while clearing it? Feel free to drop.
Attachment #8697870 - Flags: review?(smacleod) → review+
https://reviewboard.mozilla.org/r/27747/#review25271 > Would it be worth migrating anything with a uri to the new namespace while clearing it? Feel free to drop. I feel the most robust way to do this is to just delete the old data and have people re-pull to repopulate the data. I don't want to open the can of worms.
Attachment #8697871 - Flags: review?(smacleod) → review+
Comment on attachment 8697871 [details] MozReview Request: firefoxtree: automatically share tree labels with `hg share` (bug 1115188); r?smacleod https://reviewboard.mozilla.org/r/27749/#review25275 Would it be worth adding a simple command to mark an already shared repository clone as sharing firefoxtrees? or should users just manually update the share file? ::: hgext/firefoxtree/__init__.py:147 (Diff revision 1) > +def share(orig, ui, source, *args, **kwargs): it's a shame you have to copy so much boilerplate for this :/
https://reviewboard.mozilla.org/r/27749/#review25275 > it's a shame you have to copy so much boilerplate for this :/ There will be a hook point in 3.7 to make this much easier :D
https://reviewboard.mozilla.org/r/27749/#review25275 Follow-up if people ask for it. Thanks for the reviews!
https://hg.mozilla.org/hgcustom/version-control-tools/rev/0ad688fdd138d2e19b09c2e653532b7bb5224d70 firefoxtree: automatically share tree labels with `hg share` (bug 1115188); r=smacleod
And this whole series landed! The sharing will only be present on new shares. If you want to play with fire, add a "firefoxtrees" line to the .hg/shared file of each repo created from the share to retroactively add sharing. This series also wipes out all old names/refs/labels: you'll need to `hg pull` to recreate the labels.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: