allura
修訂 | c9bbc48128d44548ae9375555f791ca7fd3227b1 (tree) |
---|---|
時間 | 2012-07-10 00:22:30 |
作者 | Jenny Steele <jsteele@geek...> |
Commiter | Tim Van Steenburgh |
[#4382] Added scm getting started help
@@ -20,6 +20,40 @@ | ||
20 | 20 | <a href="log?page=1">More</a> |
21 | 21 | {% endif %} |
22 | 22 | {% else %} |
23 | + {% if h.has_access(c.app, 'write')() %} | |
24 | + <div class="message warning scm-learn-basics"> | |
25 | + <div class="content"> | |
26 | + Are you new to Git? <a href="http://git-scm.com/doc">Learn the basics</a>. | |
27 | + </div> | |
28 | + </div> | |
29 | + | |
30 | + <p>It looks like this Git repository doesn't have any files in it. Let's commit your project code now.</p> | |
31 | + | |
32 | + <h2>First time using Git</h2> | |
33 | + | |
34 | + <div class="codehilite"> | |
35 | + <pre>cd {{c.app.repo.suggested_clone_dest_path()}} | |
36 | +git init | |
37 | +git commit -a -m 'Initial commit' | |
38 | +git remote add origin {{c.app.repo.clone_url('rw', c.user.username)}} | |
39 | +git push origin master</pre> | |
40 | + </div> | |
41 | + | |
42 | + <h2>Existing Repository</h2> | |
43 | + | |
44 | + <div class="codehilite"> | |
45 | + <pre>cd {{c.app.repo.suggested_clone_dest_path()}} | |
46 | +git remote add origin {{c.app.repo.clone_url('rw', c.user.username)}} | |
47 | +git push origin master</pre> | |
48 | + </div> | |
49 | + | |
50 | + <div class="message info scm-ssh-key"> | |
51 | + <div class="content"> | |
52 | + Did you get asked for your SourceForge password during this process? You can securely use your Git repository and avoid having to re-enter your password by <a href="https://sourceforge.net/account/ssh">setting up an ssh-key</a>. | |
53 | + </div> | |
54 | + </div> | |
55 | + {% else %} | |
23 | 56 | <p><b>No (more) commits</b></p> |
57 | + {% endif %} | |
24 | 58 | {% endif %} |
25 | 59 | {% endblock %} |
@@ -21,6 +21,46 @@ | ||
21 | 21 | <a href="log?page=1">More</a> |
22 | 22 | {% endif %} |
23 | 23 | {% else %} |
24 | + {% if h.has_access(c.app, 'write')() %} | |
25 | + <div class="message warning scm-learn-basics"> | |
26 | + <div class="content"> | |
27 | + Are you new to Mercurial? <a href="http://mercurial.selenic.com/guide/">Learn the basics</a>. | |
28 | + </div> | |
29 | + </div> | |
30 | + | |
31 | + <p>It looks like this Mercurial repository doesn't have any files in it. Let's commit your project code now.</p> | |
32 | + | |
33 | + <h2>First time using Mercurial</h2> | |
34 | + | |
35 | + <div class="codehilite"> | |
36 | + <pre>{{c.app.repo.clone_command('rw')}} | |
37 | +cd {{c.app.repo.suggested_clone_dest_path()}} | |
38 | +touch README | |
39 | +hg add | |
40 | +hg commit -m 'Initial commit' | |
41 | +hg push</pre> | |
42 | + </div> | |
43 | + | |
44 | + <h2>Existing Repository</h2> | |
45 | + | |
46 | + <p>Add the new repository as a remote in .hg/hgrc like this:</p> | |
47 | + <div class="codehilite"> | |
48 | + <pre>[paths] | |
49 | +default = {{c.app.repo.clone_url('rw', c.user.username)}}</pre> | |
50 | + </div> | |
51 | + <p>Now you can push your code to the repository.</p> | |
52 | + <div class="codehilite"> | |
53 | + <pre>cd {{c.app.repo.suggested_clone_dest_path()}} | |
54 | +hg push</pre> | |
55 | + </div> | |
56 | + | |
57 | + <div class="message info scm-ssh-key"> | |
58 | + <div class="content"> | |
59 | + Did you get asked for your SourceForge password during this process? You can securely use your Git repository and avoid having to re-enter your password by <a href="https://sourceforge.net/account/ssh">setting up an ssh-key</a>. | |
60 | + </div> | |
61 | + </div> | |
62 | + {% else %} | |
24 | 63 | <p><b>No (more) commits</b></p> |
64 | + {% endif %} | |
25 | 65 | {% endif %} |
26 | 66 | {% endblock %} |
@@ -3,6 +3,7 @@ from tg.decorators import with_trailing_slash | ||
3 | 3 | from pylons import c |
4 | 4 | |
5 | 5 | from allura.controllers import repository |
6 | +from allura.lib import helpers as h | |
6 | 7 | |
7 | 8 | class BranchBrowser(repository.BranchBrowser): |
8 | 9 |
@@ -13,7 +14,7 @@ class BranchBrowser(repository.BranchBrowser): | ||
13 | 14 | @with_trailing_slash |
14 | 15 | def index(self, limit=None, page=0, count=0, **kw): |
15 | 16 | latest = c.app.repo.latest(branch=self._branch) |
16 | - if not latest: | |
17 | + if not latest or (latest.object_id.split(':')[1] == '1' and h.has_access(c.app, 'write')()): | |
17 | 18 | return dict(allow_fork=False, log=[]) |
18 | 19 | redirect(latest.url() + 'tree/') |
19 | 20 |
@@ -20,6 +20,35 @@ | ||
20 | 20 | <a href="{{c.app.url}}log?page=1">More</a> |
21 | 21 | {% endif %} |
22 | 22 | {% else %} |
23 | + {% if h.has_access(c.app, 'write')() %} | |
24 | + <div class="message warning scm-learn-basics"> | |
25 | + <div class="content"> | |
26 | + Are you new to Subversion? <a href="http://svnbook.red-bean.com/">Learn the basics</a>. | |
27 | + </div> | |
28 | + </div> | |
29 | + | |
30 | + <p>It looks like this Subversion repository doesn't have any files in it. Let's commit your project code now.</p> | |
31 | + | |
32 | + <h2>Import project to Subversion</h2> | |
33 | + | |
34 | + <div class="codehilite"> | |
35 | + <pre>cd existing-{{c.app.repo.suggested_clone_dest_path()}} | |
36 | +svn import {{c.app.repo.clone_url('rw', c.user.username)}} -m "Initial commit"</pre> | |
37 | + </div> | |
38 | + | |
39 | + <h2>Check out a working directory</h2> | |
40 | + | |
41 | + <div class="codehilite"> | |
42 | + <pre>{{c.app.repo.clone_command('rw')}}</pre> | |
43 | + </div> | |
44 | + | |
45 | + <div class="message info scm-ssh-key"> | |
46 | + <div class="content"> | |
47 | + Did you get asked for your SourceForge password during this process? You can securely use your Subversion repository and avoid having to re-enter your password by <a href="https://sourceforge.net/account/ssh">setting up an ssh-key</a>. | |
48 | + </div> | |
49 | + </div> | |
50 | + {% else %} | |
23 | 51 | <p><b>No (more) commits</b></p> |
52 | + {% endif %} | |
24 | 53 | {% endif %} |
25 | 54 | {% endblock %} |