Permalink
Browse files

Preliminary implementation of server-side forking (issue 137)

The fork mechanism clones the repository , access restrictions, and
other config options.  The app has been updated throughout to handle
personal repositories and to properly display origin/fork links.

In order to fork a repository the user account must have the #fork role,
the origin repository must permit forking, and the user account must
have standard clone permissions to the repository.

Because forking introduces a new user role no existing user accounts can
automatically begin forking a repository.  This is both a pro and a con.

Since the fork has the same access restrictions as the origin repository,
those who can access the origin may also access the fork.  This is intentional
to facilitate integration-manager workflow.  The fork owner does have the
power to completely change the access restrictions of his/her fork.
  • Loading branch information...
gitblit committed Sep 30, 2012
1 parent 0d531b1 commit 1e1b85270f93b3bca624c99b478f3a9a23be2395
Showing with 1,235 additions and 301 deletions.
  1. +23 −23 .project
  2. +9 −4 docs/04_releases.mkd
  3. +0 −1 docs/05_roadmap.mkd
  4. +46 −0 resources/gitblit.css
  5. +4 −0 src/com/gitblit/ConfigUserService.java
  6. +2 −0 src/com/gitblit/Constants.java
  7. +5 −0 src/com/gitblit/FileUserService.java
  8. +165 −20 src/com/gitblit/GitBlit.java
  9. +1 −1 src/com/gitblit/SyndicationServlet.java
  10. +4 −0 src/com/gitblit/models/ProjectModel.java
  11. +49 −0 src/com/gitblit/models/RepositoryModel.java
  12. +29 −0 src/com/gitblit/models/UserModel.java
  13. +1 −1 src/com/gitblit/utils/ActivityUtils.java
  14. +14 −0 src/com/gitblit/utils/JGitUtils.java
  15. +28 −1 src/com/gitblit/utils/StringUtils.java
  16. +4 −0 src/com/gitblit/wicket/GitBlitWebApp.java
  17. +15 −1 src/com/gitblit/wicket/GitBlitWebApp.properties
  18. +4 −5 src/com/gitblit/wicket/pages/BasePage.java
  19. +3 −1 src/com/gitblit/wicket/pages/EditRepositoryPage.html
  20. +1 −0 src/com/gitblit/wicket/pages/EditRepositoryPage.java
  21. +3 −2 src/com/gitblit/wicket/pages/EditUserPage.html
  22. +1 −0 src/com/gitblit/wicket/pages/EditUserPage.java
  23. +24 −0 src/com/gitblit/wicket/pages/ForksPage.html
  24. +133 −0 src/com/gitblit/wicket/pages/ForksPage.java
  25. +1 −1 src/com/gitblit/wicket/pages/GitSearchPage.java
  26. +1 −1 src/com/gitblit/wicket/pages/HistoryPage.java
  27. +1 −1 src/com/gitblit/wicket/pages/LogPage.java
  28. +4 −66 src/com/gitblit/wicket/pages/ProjectPage.html
  29. +12 −140 src/com/gitblit/wicket/pages/ProjectPage.java
  30. +8 −0 src/com/gitblit/wicket/pages/ProjectsPage.java
  31. +26 −6 src/com/gitblit/wicket/pages/RepositoryPage.html
  32. +109 −12 src/com/gitblit/wicket/pages/RepositoryPage.java
  33. +9 −0 src/com/gitblit/wicket/pages/RootPage.java
  34. +1 −1 src/com/gitblit/wicket/pages/SummaryPage.java
  35. +44 −0 src/com/gitblit/wicket/pages/UserPage.html
  36. +146 −0 src/com/gitblit/wicket/pages/UserPage.java
  37. +1 −1 src/com/gitblit/wicket/panels/GravatarImage.java
  38. +2 −2 src/com/gitblit/wicket/panels/HistoryPanel.java
  39. +2 −2 src/com/gitblit/wicket/panels/LogPanel.java
  40. +79 −0 src/com/gitblit/wicket/panels/ProjectRepositoryPanel.html
  41. +199 −0 src/com/gitblit/wicket/panels/ProjectRepositoryPanel.java
  42. +1 −1 src/com/gitblit/wicket/panels/RepositoriesPanel.html
  43. +18 −5 src/com/gitblit/wicket/panels/RepositoriesPanel.java
  44. +3 −2 src/com/gitblit/wicket/panels/SearchPanel.java
View
@@ -1,23 +1,23 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>gitblit</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Gitblit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
View
@@ -17,10 +17,15 @@ If you are updating from an earlier release AND you have indexed branches with t
#### additions
-- added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)
-- delete branch feature (issue 121, Github/ajermakovics)
-- added line links to blob view at the expense of zebra striping (issue 130)
-- added RedmineUserService (github/mallowlabs)
+- Added simple project pages. A project is a subfolder off the *git.repositoriesFolder*.
+- Added support for personal repositories. This builds on the simple project pages.
+Personal repositories are stored in *git.repositoriesFolder*/*~username*. Each user with personal repositories will have a user page, something like the GitHub profile page. Personal repositories have all the same features as common repositories.
+- Added support for server-side forking of a repository to a personal repository (issue 137)
+In order to fork a repository to a personal clone, the user account must have the *fork* permission **and** the repository must *allow forks*. The clone inherits the access restrictions of its origin. i.e. if Team A has access to the origin repository, then by default Team A also has access to the fork. This is to facilitate collaboration. However, the fork owner may change access to the fork and add/remove users/teams, etc as required.
+- Added support for X-Forwarded-Context for Apache subdomain proxy configurations (issue 135)
+- Delete branch feature (issue 121, Github/ajermakovics)
+- Added line links to blob view at the expense of zebra striping (issue 130)
+- Added RedmineUserService (github/mallowlabs)
#### changes
View
@@ -26,7 +26,6 @@ This list is volatile.
### IDEAS
* Gitblit: Re-use the EGit branch visualization table cell renderer as some sort of servlet
-* Gitblit: Support personal repositories (~username/repo)
* Gitblit: diff should highlight inserted/removed fragment compared to original line
* Gitblit: implement branch permission controls as Groovy pre-receive script.
*Maintain permissions text file similar to a gitolite configuration file or svn authz file.*
View
@@ -20,6 +20,11 @@ a:focus {
outline: none;
}
+[class^="icon-"], [class*=" icon-"] a i {
+ /* override for a links that look like bootstrap buttons */
+ vertical-align: text-bottom;
+}
+
hr {
margin-top: 10px;
margin-bottom: 10px;
@@ -127,6 +132,47 @@ navbar div>ul .menu-dropdown li a:hover,.nav .menu-dropdown li a:hover,.navbar d
font-weight: bold;
}
+.pageTitle {
+ color: #888;
+ font-size: 18px;
+ line-height: 27px;
+}
+.pageTitle .project, .pageTitle .repository {
+ font-family: Helvetica, arial, freesans, clean, sans-serif;
+ font-size: 22px;
+}
+
+.pageTitle .controls {
+ font-size: 12px;
+}
+
+.pageTitle .repository {
+ font-weight: bold;
+}
+
+.originRepository {
+ font-family: Helvetica, arial, freesans, clean, sans-serif;
+ color: #888;
+ font-size: 12px;
+ line-height: 14px;
+ margin: 0px;
+}
+
+.forkSource, .forkEntry {
+ color: #888;
+}
+
+.forkSource {
+ font-size: 18px;
+ line-height: 20px;
+ padding: 5px 0px;
+}
+
+.forkEntry {
+ font-size: 14px;
+ padding: 2px 0px;
+}
+
div.page_footer {
clear: both;
height: 17px;
@@ -750,6 +750,9 @@ private synchronized void write() throws IOException {
if (model.canAdmin) {
roles.add(Constants.ADMIN_ROLE);
}
+ if (model.canFork) {
+ roles.add(Constants.FORK_ROLE);
+ }
if (model.excludeFromFederation) {
roles.add(Constants.NOT_FEDERATED_ROLE);
}
@@ -858,6 +861,7 @@ protected synchronized void read() {
Set<String> roles = new HashSet<String>(Arrays.asList(config.getStringList(
USER, username, ROLE)));
user.canAdmin = roles.contains(Constants.ADMIN_ROLE);
+ user.canFork = roles.contains(Constants.FORK_ROLE);
user.excludeFromFederation = roles.contains(Constants.NOT_FEDERATED_ROLE);
// repository memberships
@@ -41,6 +41,8 @@
public static final String JGIT_VERSION = "JGit 2.1.0 (201209190230-r)";
public static final String ADMIN_ROLE = "#admin";
+
+ public static final String FORK_ROLE = "#fork";
public static final String NOT_FEDERATED_ROLE = "#notfederated";
@@ -234,6 +234,8 @@ public UserModel getUserModel(String username) {
// Permissions
if (role.equalsIgnoreCase(Constants.ADMIN_ROLE)) {
model.canAdmin = true;
+ } else if (role.equalsIgnoreCase(Constants.FORK_ROLE)) {
+ model.canFork = true;
} else if (role.equalsIgnoreCase(Constants.NOT_FEDERATED_ROLE)) {
model.excludeFromFederation = true;
}
@@ -283,6 +285,9 @@ public boolean updateUserModel(String username, UserModel model) {
if (model.canAdmin) {
roles.add(Constants.ADMIN_ROLE);
}
+ if (model.canFork) {
+ roles.add(Constants.FORK_ROLE);
+ }
if (model.excludeFromFederation) {
roles.add(Constants.NOT_FEDERATED_ROLE);
}
Oops, something went wrong.

0 comments on commit 1e1b852

Please sign in to comment.