Anonymous avatar Anonymous committed 7b9f349

added per-file history

Comments (0)

Files changed (2)

rhodecode/controllers/files.py

 
             if c.file.is_file():
                 c.file_history = self._get_node_history(c.changeset, f_path)
+                history = c.changeset.get_file_history(f_path)
+                prev_rev = c.rhodecode_repo.get_changeset(cur_rev)
+                while True:
+                    try:
+                        prev_rev = prev_rev.prev(c.branch)
+                        if prev_rev in history: break
+                    except (ChangesetDoesNotExistError, VCSError):
+                        break
+
+                next_rev = c.rhodecode_repo.get_changeset(cur_rev)
+                while True:
+                    try:
+                        next_rev = next_rev.next(c.branch)
+                        if next_rev in history: break
+                    except (ChangesetDoesNotExistError, VCSError):
+                        break
+
+                c.url_prev = url('files_home', repo_name=c.repo_name,
+                                 revision=prev_rev.raw_id, f_path=f_path)
+                if c.branch:
+                    c.url_prev += '?branch=%s' % c.branch
+
+                c.url_next = url('files_home', repo_name=c.repo_name,
+                                 revision=next_rev.raw_id, f_path=f_path)
+                if c.branch:
+                    c.url_next += '?branch=%s' % c.branch
             else:
                 c.file_history = []
         except RepositoryError, e:

rhodecode/templates/files/files_source.html

 		</div>
 	</dd>
 </dl>
-
+<div class="browser-header">
+  <div class="browser-nav">
+    ${h.form(h.url.current())}
+    <div class="info_box">
+      <span class="rev">${_('view')}@rev</span>
+      <a class="ui-btn" href="${c.url_prev}" title="${_('previous revision')}">&laquo;</a>
+      ${h.text('at_rev',value=c.changeset.revision,size=5)}
+      <a class="ui-btn" href="${c.url_next}" title="${_('next revision')}">&raquo;</a>
+      ## ${h.submit('view',_('view'),class_="ui-btn")}
+    </div>
+    ${h.end_form()}
+</div>
+<div class="browser-branch">
+  ${h.checkbox('stay_at_branch',c.changeset.branch,c.changeset.branch==c.branch)}
+  <label>${_('follow current branch')}</label>
+</div>
 <div id="body" class="codeblock">
 	<div class="code-header">
         <div class="stats">
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.