User branches in Gerrit. refs/dev/${username}/* description request

1,662 views
Skip to first unread message

Mateusz Grzechociński

unread,
Jan 24, 2012, 1:41:42 PM1/24/12
to Repo and Gerrit Discussion
Hi,

first of all, thanks for such a great tool like Gerrit. This is my
first post here and I'm glad I'm a yet another happy user of Gerrit.
In my project we need to have some remote branches hosted by Gerrit.
Every user need to have at least one, for his private usage. Sometimes
he should share this branch with another user.
Main feature is to be able to manage those branches: see whether they
live or not, who is it's owner, is it legacy and can it be deleted or
not.

After crowling internet, I've already read a few words written by
Shawn Pearce when talking about changing Gerrit username:
"The reason is, Gerrit now supports per-user branch names. A project
owner may setup an access rule such as: refs/dev/${username}/* Push
+3 Allowing a user to push any branch they choose, so long as its
prefixed with their current username."

Seems fine, but to mysterious for me. What is +3? What group should I
add for those access? Does it mean that private remote branch created
in refs/dev/${username} space is visible only by this user?
Finally, is there any piece of documentation for that feature? Can you
add one of say a few words about it here?

Thanks in advance,
Matthew

Edwin Kempin

unread,
Jan 26, 2012, 1:33:26 AM1/26/12
to Mateusz Grzechociński, Repo and Gerrit Discussion


2012/1/24 Mateusz Grzechociński <mateusz.gr...@gmail.com>

Hi,

first of all, thanks for such a great tool like Gerrit. This is my
first post here and I'm glad I'm a yet another happy user of Gerrit.
In my project we need to have some remote branches hosted by Gerrit.
Every user need to have at least one, for his private usage. Sometimes
he should share this branch with another user.
Main feature is to be able to manage those branches: see whether they
live or not, who is it's owner, is it legacy and can it be deleted or
not.

After crowling internet, I've already read a few words written by
Shawn Pearce when talking about changing Gerrit username:
"The reason is, Gerrit now supports per-user branch names.  A project
owner may setup an access rule such as: refs/dev/${username}/*  Push
+3 Allowing a user to push any branch they choose, so long as its
prefixed with their current username."

Seems fine, but to mysterious for me. What is +3?
It means to assign the 'Push Branch +3' access right. This access right only exists until Gerrit 2.1.x. For Gerrit 2.2.x the access rights were redesigned. To allow 'Push Branch +3' in Gerrit 2.2.x you would need to assign the 'Create Reference' access right and the 'Push' access right with the 'Force' option being set. How the access rights are mapped between Gerrit 2.1.x and Gerrit 2.2.x is explained here [1].

[1] https://gerrit-review.googlesource.com/Documentation/access-control.html#conversion_table
 
What group should I
add for those access?
You should assign it to a group that contains all the users that you want to enable to create their own user-specific branches. E.g. if you want to enable this feature for all users, you can assign the access rights to the 'Registered Users' group.
 
Does it mean that private remote branch created
in refs/dev/${username} space is visible only by this user?
This depends on your access rights configuration. Every user who has 'Read' access for these refs can see the branches. E.g. if you assign the 'Read' access right on 'refs/dev/*' to the 'Registered Users' group, then every user will be able to see all these branches.
 
Finally, is there any piece of documentation for that feature? Can you
add one of say a few words about it here?
There is not much documentation about this feature. AFAIK it's mentioned only at [2] and [3].

[2] https://gerrit-review.googlesource.com/Documentation/access-control.html#_project_access_control_lists
[3] https://gerrit-review.googlesource.com/Documentation/access-control.html#category_create

One thing that might be interesting is to assign the 'Owner' access right on 'refs/dev/${username}'. This would enable the owner of the user specific branch to grant access for his user-specific branches to other users. That is e.g. useful if 2 developers want to collaborate within a user-specific branch.
 

Thanks in advance,
Matthew

--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

Mateusz Grzechociński

unread,
Jan 27, 2012, 12:42:16 PM1/27/12
to Repo and Gerrit Discussion
Hi, thanks for your reply.

On Jan 26, 7:33 am, Edwin Kempin <edwin.kem...@gmail.com> wrote:
> To allow 'Push Branch +3' in Gerrit 2.2.x you would need to
> assign the 'Create Reference' access right and the 'Push' access right with
> the 'Force' option being set. How the access rights are mapped between
> Gerrit 2.1.x and Gerrit 2.2.x is explained here [1].

Ok, I've already added above rights to the group I belong to. I'm now
able to create branch and push it to origin [1], but how can I see it
or switch to it?
When listing project branches through Gerrit web UI, there is nothing
than master.

[1] mgrzechocinski@mghp:~/dev/RD/javaproject[master]$ git push origin
HEAD:refs/dev/mateusz.grzechocinski/test_branch
Total 0 (delta 0), reused 0 (delta 0)
To ssh://gerrit/test/javaproject.git
* [new branch] HEAD -> refs/dev/mateusz.grzechocinski/
test_branch

Thanks in advance for any reply.
Matthew

Edwin Kempin

unread,
Jan 27, 2012, 2:14:20 PM1/27/12
to Mateusz Grzechociński, Repo and Gerrit Discussion
Hi Matthew,

if I remember correctly the Gerrit WebUI only shows the branches under 'refs/heads/' + the 'refs/meta/config' branch. Everything else is filtered out.

If you want your user-specific branches to be visible in the ProjectBranchesScreen you may assign the access rights to something like 'refs/heads/${username}/*' or 'refs/heads/sandbox/${username}/*' instead of 'refs/dev/${username}/*'.

Best regards,
Edwin

2012/1/27 Mateusz Grzechociński <mateusz.gr...@gmail.com>
Matthew

Reply all
Reply to author
Forward
0 new messages