Changeset - f5a1314886ec
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 12 years ago 2013-05-22 03:17:42
marcin@python-works.com
replace list appends with list literals when possible
5 files changed with 7 insertions and 15 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/feed.py
Show inline comments
 
@@ -78,27 +78,26 @@ class FeedController(BaseRepoController)
 
        for st in _parsed:
 
            st.update({'added': st['stats']['added'],
 
                       'removed': st['stats']['deleted']})
 
            changes.append('\n %(operation)s %(filename)s '
 
                           '(%(added)s lines added, %(removed)s lines removed)'
 
                            % st)
 
        if limited_diff:
 
            changes = changes + ['\n ' +
 
                                 _('Changeset was too big and was cut off...')]
 
        return diff_processor, changes
 

	
 
    def __get_desc(self, cs):
 
        desc_msg = []
 
        desc_msg.append((_('%s committed on %s')
 
                         % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>')
 
        desc_msg = [(_('%s committed on %s')
 
                     % (h.person(cs.author), h.fmt_date(cs.date))) + '<br/>']
 
        #branches, tags, bookmarks
 
        if cs.branch:
 
            desc_msg.append('branch: %s<br/>' % cs.branch)
 
        if h.is_hg(c.rhodecode_repo):
 
            for book in cs.bookmarks:
 
                desc_msg.append('bookmark: %s<br/>' % book)
 
        for tag in cs.tags:
 
            desc_msg.append('tag: %s<br/>' % tag)
 
        diff_processor, changes = self.__changes(cs)
 
        # rev link
 
        _url = url('changeset_home', repo_name=cs.repository.name,
 
                   revision=cs.raw_id, qualified=True)
rhodecode/lib/helpers.py
Show inline comments
 
@@ -589,29 +589,27 @@ def action_parser(user_log, feed=False, 
 
                        log.error('cannot find revision %s in this repo' % rev)
 
                        revs.append(rev)
 
                        continue
 
                else:
 
                    _rev = AttributeDict({
 
                        'short_id': rev[:12],
 
                        'raw_id': rev,
 
                        'message': '',
 
                        'op': _op,
 
                        'ref_name': _name
 
                    })
 
                    revs.append(_rev)
 
        cs_links = []
 
        cs_links.append(" " + ', '.join(
 
        cs_links = [" " + ', '.join(
 
            [lnk(rev, repo_name) for rev in revs[:revs_limit]]
 
            )
 
        )
 
        )]
 
        _op1, _name1 = _get_op(revs_ids[0])
 
        _op2, _name2 = _get_op(revs_ids[-1])
 

	
 
        _rev = '%s...%s' % (_name1, _name2)
 

	
 
        compare_view = (
 
            ' <div class="compare_view tooltip" title="%s">'
 
            '<a href="%s">%s</a> </div>' % (
 
                _('Show all combined changesets %s->%s') % (
 
                    revs_ids[0][:12], revs_ids[-1][:12]
 
                ),
 
                url('changeset_home', repo_name=repo_name,
rhodecode/lib/middleware/simplegit.py
Show inline comments
 
@@ -46,26 +46,25 @@ class SimpleGitUploadPackHandler(dulserv
 
        objects_iter = self.repo.fetch_objects(
 
          graph_walker.determine_wants, graph_walker, self.progress,
 
          get_tagged=self.get_tagged)
 

	
 
        # Did the process short-circuit (e.g. in a stateless RPC call)? Note
 
        # that the client still expects a 0-object pack in most cases.
 
        if objects_iter is None:
 
            return
 

	
 
        self.progress("counting objects: %d, done.\n" % len(objects_iter))
 
        dulserver.write_pack_objects(dulserver.ProtocolFile(None, write),
 
                                     objects_iter)
 
        messages = []
 
        messages.append('thank you for using rhodecode')
 
        messages = ['thank you for using rhodecode']
 

	
 
        for msg in messages:
 
            self.progress(msg + "\n")
 
        # we are done
 
        self.proto.write("0000")
 

	
 

	
 
dulserver.DEFAULT_HANDLERS = {
 
  #git-ls-remote, git-clone, git-fetch and git-pull
 
  'git-upload-pack': SimpleGitUploadPackHandler,
 
  #git-push
 
  'git-receive-pack': dulserver.ReceivePackHandler,
rhodecode/lib/vcs/backends/git/config.py
Show inline comments
 
@@ -309,27 +309,25 @@ class StackedConfig(Config):
 

	
 
    def __repr__(self):
 
        return "<%s for %r>" % (self.__class__.__name__, self.backends)
 

	
 
    @classmethod
 
    def default_backends(cls):
 
        """Retrieve the default configuration.
 

	
 
        This will look in the repository configuration (if for_path is
 
        specified), the users' home directory and the system
 
        configuration.
 
        """
 
        paths = []
 
        paths.append(os.path.expanduser("~/.gitconfig"))
 
        paths.append("/etc/gitconfig")
 
        paths = [os.path.expanduser("~/.gitconfig"), "/etc/gitconfig"]
 
        backends = []
 
        for path in paths:
 
            try:
 
                cf = ConfigFile.from_path(path)
 
            except (IOError, OSError), e:
 
                if e.errno != errno.ENOENT:
 
                    raise
 
                else:
 
                    continue
 
            backends.append(cf)
 
        return backends
 

	
rhodecode/lib/vcs/backends/git/repository.py
Show inline comments
 
@@ -626,27 +626,25 @@ class GitRepository(BaseRepository):
 
        elif not update_after_clone:
 
            cmd.append('--no-checkout')
 
        cmd += ['--', '"%s"' % url, '"%s"' % self.path]
 
        cmd = ' '.join(cmd)
 
        # If error occurs run_git_command raises RepositoryError already
 
        self.run_git_command(cmd)
 

	
 
    def pull(self, url):
 
        """
 
        Tries to pull changes from external location.
 
        """
 
        url = self._get_url(url)
 
        cmd = ['pull']
 
        cmd.append("--ff-only")
 
        cmd.append(url)
 
        cmd = ['pull', "--ff-only", url]
 
        cmd = ' '.join(cmd)
 
        # If error occurs run_git_command raises RepositoryError already
 
        self.run_git_command(cmd)
 

	
 
    def fetch(self, url):
 
        """
 
        Tries to pull changes from external location.
 
        """
 
        url = self._get_url(url)
 
        so, se = self.run_git_command('ls-remote -h %s' % url)
 
        refs = []
 
        for line in (x for x in so.splitlines()):
0 comments (0 inline, 0 general)