Changeset - 63adb3d5233a
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-04-26 14:14:46
marcin@python-works.com
fixed some unicode problems with git file path
2 files changed with 8 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/vcs/backends/git/changeset.py
Show inline comments
 
@@ -8,25 +8,25 @@ from rhodecode.lib.vcs.exceptions import
 
from rhodecode.lib.vcs.exceptions import ChangesetError
 
from rhodecode.lib.vcs.exceptions import NodeDoesNotExistError
 
from rhodecode.lib.vcs.exceptions import VCSError
 
from rhodecode.lib.vcs.exceptions import ChangesetDoesNotExistError
 
from rhodecode.lib.vcs.exceptions import ImproperArchiveTypeError
 
from rhodecode.lib.vcs.backends.base import BaseChangeset, EmptyChangeset
 
from rhodecode.lib.vcs.nodes import FileNode, DirNode, NodeKind, RootNode, \
 
    RemovedFileNode, SubModuleNode, ChangedFileNodesGenerator,\
 
    AddedFileNodesGenerator, RemovedFileNodesGenerator
 
from rhodecode.lib.vcs.utils import safe_unicode
 
from rhodecode.lib.vcs.utils import date_fromtimestamp
 
from rhodecode.lib.vcs.utils.lazy import LazyProperty
 
from rhodecode.lib.utils2 import safe_int
 
from rhodecode.lib.utils2 import safe_int, safe_str
 

	
 

	
 
class GitChangeset(BaseChangeset):
 
    """
 
    Represents state of the repository at single revision.
 
    """
 

	
 
    def __init__(self, repository, revision):
 
        self._stat_modes = {}
 
        self.repository = repository
 

	
 
        try:
 
@@ -280,33 +280,36 @@ class GitChangeset(BaseChangeset):
 
        """
 
        return self.get_file_history(path, limit=1)[0]
 

	
 
    def get_file_history(self, path, limit=None):
 
        """
 
        Returns history of file as reversed list of ``Changeset`` objects for
 
        which file at given ``path`` has been modified.
 

	
 
        TODO: This function now uses os underlying 'git' and 'grep' commands
 
        which is generally not good. Should be replaced with algorithm
 
        iterating commits.
 
        """
 
        self._get_filectx(path)
 
        cs_id = safe_str(self.id)
 
        f_path = safe_str(path)
 

	
 
        self._get_filectx(path)
 
        if limit:
 
            cmd = 'log -n %s --pretty="format: %%H" -s -p %s -- "%s"' % (
 
                      safe_int(limit, 0), self.id, path
 
                      safe_int(limit, 0), cs_id, f_path
 
                   )
 

	
 
        else:
 
            cmd = 'log --pretty="format: %%H" -s -p %s -- "%s"' % (
 
                      self.id, path
 
                      cs_id, f_path
 
                   )
 
        so, se = self.repository.run_git_command(cmd)
 
        ids = re.findall(r'[0-9a-fA-F]{40}', so)
 
        return [self.repository.get_changeset(id) for id in ids]
 

	
 
    def get_file_history_2(self, path):
 
        """
 
        Returns history of file as reversed list of ``Changeset`` objects for
 
        which file at given ``path`` has been modified.
 

	
 
        """
 
        self._get_filectx(path)
rhodecode/templates/files/files.html
Show inline comments
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title(*args)">
 
    ${_('%s Files') % c.repo_name}
 
    %if hasattr(c,'file'):
 
        &middot; ${c.file.path or '\\'}
 
        &middot; ${h.safe_unicode(c.file.path) or '\\'}
 
    %endif
 
    &middot; ${c.rhodecode_name}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${_('Files')}
 
    %if c.file:
 
        @ ${h.show_id(c.changeset)}
 
    %endif
 
</%def>
 

	
 
<%def name="page_nav()">
0 comments (0 inline, 0 general)