Closed
Bug 1316273
Opened 8 years ago
Closed 7 years ago
Support custom repository branches
Categories
(Webtools Graveyard :: Pontoon, defect, P3)
Webtools Graveyard
Pontoon
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mathjazz, Assigned: thecount)
Details
Pontoon can only pull from/push to default repository branch. For various reasons (protected branches, commit history pollution, etc.) project authors sometimes prefer Pontoon to push to a different branch. We should support that.
Assignee | ||
Comment 1•7 years ago
|
||
Been poking around on this bug. So far, I have Pontoon running locally, and just need to connect it to a test repository so I can test it. So I'm guessing I need the test repo to have my local pontoon as a contributor, so it can make commits? Is the github contributor for local dev still mozilla-pontoon? Another question, when I'm in the project admin page, I see a field for "Download prefix:" which is mandatory. Not sure what this is or what should go there. In general, I think I need to find some docs on connecting pontoon to git from the pontoon admin side of things. Or any other links that may help. Thanks.
Reporter | ||
Comment 2•7 years ago
|
||
Hey Scott, thanks for digging into it! For testing purposes, we usually set up repositories in personal GitHub accounts. Your development machine should already have write access there, so Pontoon should be able to push out of the box. Download prefix is a hack around Heroku's ephemeral storage. Since you won need it, simply type any string into the field: https://github.com/mozilla/pontoon/blob/master/pontoon/base/models.py#L1087 Our project management team uses these docs for adding projects: https://github.com/mozilla-l10n/documentation/blob/master/tools/pontoon/adding_new_project.md We should probably keep a stripped down version of it in developer docs. We can also do this as part of bug 1203788 (current version is accessible at http://localhost:8000/a/ locally).
Assignee | ||
Comment 3•7 years ago
|
||
Thanks, that's helpful and got me further. So, I added a new project, but it's not showing up in the project list. I can only see it under Admin. So, instead I tried to change the default Pontoon Intro project to point to a fork of that repo, and made some changes, but I have not seen any commits to the repo yet. Do I need to approve changes or is it automatic?
Comment 4•7 years ago
|
||
I wonder, from a VCS and project setup POV, this should be a setup similar to one where l10n and en-US are in separate repos, right? We probably also need to maintain two working copies during VCS sync?
Reporter | ||
Comment 5•7 years ago
|
||
(In reply to Scott [:thecount] Downe from comment #3) > Thanks, that's helpful and got me further. > > So, I added a new project, but it's not showing up in the project list. I > can only see it under Admin. Yeah, you need to sync Pontoon with the repo , so it can import the necessary strings and expose the project for translation. In local development environment, sync needs to be triggered manually: ./manage.py sync_projects YOUR_PROJECT_SLUG Only added/deleted translations have impact on sync, suggestions don't. If you're logged in as superuser, you will submit translation by default (marked with green icon, blue represents suggestions).
Assignee | ||
Comment 6•7 years ago
|
||
That fixed the one problem, project can load now, but making changes still won't commit to my test repo. I'll debug more tomorrow night, but it feels like I'm missing something obvious. It's not throwing any errors, and is somehow loading my changes after I change something in pontoon. But github is still old stuff.
Assignee | ||
Comment 7•7 years ago
|
||
Ah, got it to sync! OK, I should be good to do this bug ;)
Reporter | ||
Comment 8•7 years ago
|
||
Excellent! Let me know if you have any further questions or stop by in #pontoon. (In reply to Axel Hecht [:Pike] from comment #4) > I wonder, from a VCS and project setup POV, this should be a setup similar > to one where l10n and en-US are in separate repos, right? We probably also > need to maintain two working copies during VCS sync? I'm not sure. In multiple-repo scenario, multiple Repository instances need to be specified during project setup. In our case we need to add an optional "branch" field to the model: https://github.com/mozilla/pontoon/blob/master/pontoon/base/models.py#L1068 The only change this bug brings is that Pontoon syncs with the custom branch instead of the default one.
Comment 9•7 years ago
|
||
(In reply to Matjaz Horvat [:mathjazz] from comment #8) > > The only change this bug brings is that Pontoon syncs with the custom branch > instead of the default one. Is that actually the intent? I would have expected the intent to be "take en-US strings from master, push localizations to pontoon-dump"
Reporter | ||
Comment 10•7 years ago
|
||
Blake, could you please help us clarify this?
Flags: needinfo?(bwinton)
Comment 11•7 years ago
|
||
I think there's value in using the same branch for en-US and l10n, e.g. you can expose new strings when you're ready on the branch, and move on with development on master. The only cons of that is that you need to keep en-US in sync between master and branch.
Comment 12•7 years ago
|
||
Given that I currently need to keep en-US in sync between master and an entirely separate repo, the way Scott implemented it seems good to me. ;) Also, I think that if I specified a branch, I would expect Pontoon to only use that branch, not to pull stuff from some other (non-configurable) branch.
Flags: needinfo?(bwinton)
Comment 13•7 years ago
|
||
... having thought about it some more, there's probably a semi-canonical extension to "one repo with one non-default branch" to "one repo with two branches". It'd be good to implement the first such that we can add the latter with limited impact.
Assignee | ||
Comment 14•7 years ago
|
||
I have a WIP pull request here: https://github.com/mozilla/pontoon/pull/538 It's working in my tests, but I'm pretty new to Python and the Pontoon source, so I could use some feedback :) I can see value in having en-US on master, if it's configured that way, but I also see value in having en-US on an l10n branch. Either way, needs to be explicitly configured that way. Having the ability to commit to a branch other than master feels like a step towards both of those goals.
Assignee | ||
Comment 15•7 years ago
|
||
Oh also, how do we want to handle this for other types of revision control? I'm not super familiar with hg or svn, so not sure how a branch equivalent would work, or if it's even valuable. I think ideally we do this in a way where it works for Git, and is easy to add to hg or svn if required. Thoughts?
Comment 16•7 years ago
|
||
Mercurial has two concepts in this realm: - branches are metadata for the commit - bookmarks are symbolic names for heads, and semantically like git branches We can probably support bookmarks in the same fashion as git branches, mercurial branches are harder. In SVN, branches are just paths in the upstream repo.
Comment 17•7 years ago
|
||
More questions: Should there be a validation step that the branch/bookmark actually exists upstream?
Assignee | ||
Comment 18•7 years ago
|
||
Yeah, a validation step would be pretty nice. Although, it doesn't look like it currently does validation for the github url field, I can type in nonsense, and it creates a project. In regards to svn and hg, would this be a useful feature based on their workflows? We can either add support to those now, or do it in a later patch. I would prefer a later patch ;). In both cases, we need to figure out what to do with the input label. Maybe change it to "git branch" in the case of only supporting git, and "branch/path/bookmark" in the case of supporting all three.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → scott
Reporter | ||
Comment 19•7 years ago
|
||
Added review notes on GitHub. Validation would be nice, but I think it's out of scope of this bug. So far Pontoon hasn't made any distinctions between different repository types and it would be nice to keep it that way. But I'm OK if this is a Git-only feature for now and we file a bug to extend it to other VCS types later. At this point it doesn't seem likely anyone would need custom branch support in either HG or SVN.
Comment 20•7 years ago
|
||
Commit pushed to master at https://github.com/mozilla/pontoon https://github.com/mozilla/pontoon/commit/f4117b1ca42384908a8a0ae3392c460fdcb1cb6e Fix bug 1316273: Add support for Git branches (#538)
Updated•7 years ago
|
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Updated•3 years ago
|
Product: Webtools → Webtools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•