Mercurial > kallithea
annotate rhodecode/lib/vcs/backends/git/repository.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | a5888ca796b5 |
children | 7e5f8c12a3fc |
rev | line source |
---|---|
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 """ |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
3 vcs.backends.git.repository |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
6 Git repository implementation. |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 :created_on: Apr 8, 2010 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 :copyright: (c) 2010-2011 by Marcin Kuzminski, Lukasz Balcerzak. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 import os |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 import re |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 import time |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
15 import urllib |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
16 import urllib2 |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
17 import logging |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
18 import posixpath |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
19 import string |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
20 |
2975
e0da2c0ecee1
fixes #625 Git-Tags are not displayed in Shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
2807
diff
changeset
|
21 from dulwich.objects import Tag |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
22 from dulwich.repo import Repo, NotGitRepository |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
23 from dulwich.config import ConfigFile |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
24 |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
25 from rhodecode.lib.vcs import subprocessio |
3747
600ffde2634c
changelog pagination with branch filtering now uses
Marcin Kuzminski <marcin@python-works.com>
parents:
3631
diff
changeset
|
26 from rhodecode.lib.vcs.backends.base import BaseRepository, CollectionGenerator |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
27 from rhodecode.lib.vcs.conf import settings |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
28 |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
29 from rhodecode.lib.vcs.exceptions import ( |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
30 BranchDoesNotExistError, ChangesetDoesNotExistError, EmptyRepositoryError, |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
31 RepositoryError, TagAlreadyExistError, TagDoesNotExistError |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
32 ) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 from rhodecode.lib.vcs.utils import safe_unicode, makedate, date_fromtimestamp |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
34 from rhodecode.lib.vcs.utils.lazy import LazyProperty |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 from rhodecode.lib.vcs.utils.ordered_dict import OrderedDict |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
36 from rhodecode.lib.vcs.utils.paths import abspath, get_user_home |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
37 |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
38 from rhodecode.lib.vcs.utils.hgcompat import ( |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
39 hg_url, httpbasicauthhandler, httpdigestauthhandler |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
40 ) |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
41 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 from .changeset import GitChangeset |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 from .inmemory import GitInMemoryChangeset |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
44 from .workdir import GitWorkdir |
2676
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
45 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
46 SHA_PATTERN = re.compile(r'^[[0-9a-fA-F]{12}|[0-9a-fA-F]{40}]$') |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
47 |
2676
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
48 log = logging.getLogger(__name__) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
49 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
50 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
51 class GitRepository(BaseRepository): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
52 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
53 Git repository backend. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
54 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
55 DEFAULT_BRANCH_NAME = 'master' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 scm = 'git' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
57 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
58 def __init__(self, repo_path, create=False, src_url=None, |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
59 update_after_clone=False, bare=False): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
60 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
61 self.path = abspath(repo_path) |
3043
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
62 repo = self._get_repo(create, src_url, update_after_clone, bare) |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
63 self.bare = repo.bare |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
64 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
65 @property |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
66 def _config_files(self): |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
67 return [ |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
68 self.bare and abspath(self.path, 'config') |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
69 or abspath(self.path, '.git', 'config'), |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
70 abspath(get_user_home(), '.gitconfig'), |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
71 ] |
3043
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
72 |
3579
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
73 @property |
3043
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
74 def _repo(self): |
3577
238486bb71ab
Switched handling of RhodeCode extra params in consistent way
Marcin Kuzminski <marcin@python-works.com>
parents:
3575
diff
changeset
|
75 return Repo(self.path) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
76 |
3043
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
77 @property |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
78 def head(self): |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
79 try: |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
80 return self._repo.head() |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
81 except KeyError: |
b61824e61e68
Don't cache dulwich Repos, in pararell multithreaded evniroment dulwich pack file openers
Marcin Kuzminski <marcin@python-works.com>
parents:
2995
diff
changeset
|
82 return None |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
83 |
3835
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
84 @property |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
85 def _empty(self): |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
86 """ |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
87 Checks if repository is empty ie. without any changesets |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
88 """ |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
89 |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
90 try: |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
91 self.revisions[0] |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
92 except (KeyError, IndexError): |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
93 return True |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
94 return False |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
95 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
96 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
97 def revisions(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
98 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
99 Returns list of revisions' ids, in ascending order. Being lazy |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
100 attribute allows external tools to inject shas from cache. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
101 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
102 return self._get_all_revisions() |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
103 |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
104 @classmethod |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
105 def _run_git_command(cls, cmd, **opts): |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
106 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
107 Runs given ``cmd`` as git command and returns tuple |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
108 (stdout, stderr). |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
109 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
110 :param cmd: git command to be executed |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
111 :param opts: env options to pass into Subprocess command |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
112 """ |
2183
9d27481228a1
Extend GIT command wrapper with GIT_CONFIG_NOGLOBAL=1 to bypass gitconfig global
Marcin Kuzminski <marcin@python-works.com>
parents:
2047
diff
changeset
|
113 |
3397
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
114 if '_bare' in opts: |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
115 _copts = [] |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
116 del opts['_bare'] |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
117 else: |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
118 _copts = ['-c', 'core.quotepath=false', ] |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
119 safe_call = False |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
120 if '_safe' in opts: |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
121 #no exc on failure |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
122 del opts['_safe'] |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
123 safe_call = True |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
124 |
2200
d7a4c7e3528e
fixed git-command wrapper
Marcin Kuzminski <marcin@python-works.com>
parents:
2199
diff
changeset
|
125 _str_cmd = False |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
126 if isinstance(cmd, basestring): |
2199
31ebf7010566
various fixes for git and mercurial with InMemoryCommit backend and non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents:
2198
diff
changeset
|
127 cmd = [cmd] |
2200
d7a4c7e3528e
fixed git-command wrapper
Marcin Kuzminski <marcin@python-works.com>
parents:
2199
diff
changeset
|
128 _str_cmd = True |
2367
86aa4f1f130b
white space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2325
diff
changeset
|
129 |
2325
18d34a56a736
fix for issue #417, git execution was broken on windows for certain commands.
Marcin Kuzminski <marcin@python-works.com>
parents:
2320
diff
changeset
|
130 gitenv = os.environ |
2616
bab7eaa2cd7d
Remove GIT_DIT from environ on calling git_command, it can break a lot of stuff
Marcin Kuzminski <marcin@python-works.com>
parents:
2539
diff
changeset
|
131 # need to clean fix GIT_DIR ! |
bab7eaa2cd7d
Remove GIT_DIT from environ on calling git_command, it can break a lot of stuff
Marcin Kuzminski <marcin@python-works.com>
parents:
2539
diff
changeset
|
132 if 'GIT_DIR' in gitenv: |
bab7eaa2cd7d
Remove GIT_DIT from environ on calling git_command, it can break a lot of stuff
Marcin Kuzminski <marcin@python-works.com>
parents:
2539
diff
changeset
|
133 del gitenv['GIT_DIR'] |
2325
18d34a56a736
fix for issue #417, git execution was broken on windows for certain commands.
Marcin Kuzminski <marcin@python-works.com>
parents:
2320
diff
changeset
|
134 gitenv['GIT_CONFIG_NOGLOBAL'] = '1' |
2199
31ebf7010566
various fixes for git and mercurial with InMemoryCommit backend and non-ascii files
Marcin Kuzminski <marcin@python-works.com>
parents:
2198
diff
changeset
|
135 |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
136 _git_path = settings.GIT_EXECUTABLE_PATH |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
137 cmd = [_git_path] + _copts + cmd |
2200
d7a4c7e3528e
fixed git-command wrapper
Marcin Kuzminski <marcin@python-works.com>
parents:
2199
diff
changeset
|
138 if _str_cmd: |
d7a4c7e3528e
fixed git-command wrapper
Marcin Kuzminski <marcin@python-works.com>
parents:
2199
diff
changeset
|
139 cmd = ' '.join(cmd) |
3830
08d439bfbd8c
fixed handling shell argument in subprocess calls, it always was hardcoded even when passed properly in arguments
Marcin Kuzminski <marcin@python-works.com>
parents:
3805
diff
changeset
|
140 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
141 try: |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
142 _opts = dict( |
2325
18d34a56a736
fix for issue #417, git execution was broken on windows for certain commands.
Marcin Kuzminski <marcin@python-works.com>
parents:
2320
diff
changeset
|
143 env=gitenv, |
3830
08d439bfbd8c
fixed handling shell argument in subprocess calls, it always was hardcoded even when passed properly in arguments
Marcin Kuzminski <marcin@python-works.com>
parents:
3805
diff
changeset
|
144 shell=True, |
2325
18d34a56a736
fix for issue #417, git execution was broken on windows for certain commands.
Marcin Kuzminski <marcin@python-works.com>
parents:
2320
diff
changeset
|
145 ) |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
146 _opts.update(opts) |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
147 p = subprocessio.SubprocessIOChunker(cmd, **_opts) |
2676
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
148 except (EnvironmentError, OSError), err: |
3397
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
149 tb_err = ("Couldn't run git command (%s).\n" |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
150 "Original error was:%s\n" % (cmd, err)) |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
151 log.error(tb_err) |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
152 if safe_call: |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
153 return '', err |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
154 else: |
64c194492aad
--version command should be safe, and bare no modifications
Marcin Kuzminski <marcin@python-works.com>
parents:
3396
diff
changeset
|
155 raise RepositoryError(tb_err) |
2676
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
156 |
2760
fd5f2b217488
get stderr also for git commands, pass in shell = False
Marcin Kuzminski <marcin@python-works.com>
parents:
2706
diff
changeset
|
157 return ''.join(p.output), ''.join(p.error) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
158 |
3376
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
159 def run_git_command(self, cmd): |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
160 opts = {} |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
161 if os.path.isdir(self.path): |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
162 opts['cwd'] = self.path |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
163 return self._run_git_command(cmd, **opts) |
e67b2ef07a8e
git executable is now configurable via .ini files
Marcin Kuzminski <marcin@python-works.com>
parents:
3178
diff
changeset
|
164 |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
165 @classmethod |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
166 def _check_url(cls, url): |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
167 """ |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
168 Function will check given url and try to verify if it's a valid |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
169 link. Sometimes it may happened that git will issue basic |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
170 auth request that can cause whole API to hang when used from python |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
171 or other external calls. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
172 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
173 On failures it'll raise urllib2.HTTPError, exception is also thrown |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
174 when the return code is non 200 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
175 """ |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
176 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
177 # check first if it's not an local url |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
178 if os.path.isdir(url) or url.startswith('file:'): |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
179 return True |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
180 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
181 if '+' in url[:url.find('://')]: |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
182 url = url[url.find('+') + 1:] |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
183 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
184 handlers = [] |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
185 url_obj = hg_url(url) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
186 test_uri, authinfo = url_obj.authinfo() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
187 url_obj.passwd = '*****' |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
188 cleaned_uri = str(url_obj) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
189 |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
190 if not test_uri.endswith('info/refs'): |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
191 test_uri = test_uri.rstrip('/') + '/info/refs' |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
192 |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
193 if authinfo: |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
194 #create a password manager |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
195 passmgr = urllib2.HTTPPasswordMgrWithDefaultRealm() |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
196 passmgr.add_password(*authinfo) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
197 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
198 handlers.extend((httpbasicauthhandler(passmgr), |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
199 httpdigestauthhandler(passmgr))) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
200 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
201 o = urllib2.build_opener(*handlers) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
202 o.addheaders = [('User-Agent', 'git/1.7.8.0')] # fake some git |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
203 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
204 q = {"service": 'git-upload-pack'} |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
205 qs = '?%s' % urllib.urlencode(q) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
206 cu = "%s%s" % (test_uri, qs) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
207 req = urllib2.Request(cu, None, {}) |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
208 |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
209 try: |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
210 resp = o.open(req) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
211 if resp.code != 200: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
212 raise Exception('Return Code is not 200') |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
213 except Exception, e: |
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
214 # means it cannot be cloned |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
215 raise urllib2.URLError("[%s] org_exc: %s" % (cleaned_uri, e)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
216 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
217 # now detect if it's proper git repo |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
218 gitdata = resp.read() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
219 if not 'service=git-upload-pack' in gitdata: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
220 raise urllib2.URLError( |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
221 "url [%s] does not look like an git" % (cleaned_uri)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
222 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
223 return True |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
224 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
225 def _get_repo(self, create, src_url=None, update_after_clone=False, |
2807
57456b1c215b
git forks were not created as bare repos
Marcin Kuzminski <marcin@python-works.com>
parents:
2760
diff
changeset
|
226 bare=False): |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
227 if create and os.path.exists(self.path): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
228 raise RepositoryError("Location already exist") |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
229 if src_url and not create: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
230 raise RepositoryError("Create should be set to True if src_url is " |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
231 "given (clone operation creates repository)") |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
232 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
233 if create and src_url: |
2704
959d0daa44da
Added url validator for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2676
diff
changeset
|
234 GitRepository._check_url(src_url) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
235 self.clone(src_url, update_after_clone, bare) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
236 return Repo(self.path) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
237 elif create: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
238 os.makedirs(self.path) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
239 if bare: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
240 return Repo.init_bare(self.path) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
241 else: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
242 return Repo.init(self.path) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
243 else: |
3396
3faf7a7eebb3
use cache repo when creating GitRepository instances
Marcin Kuzminski <marcin@python-works.com>
parents:
3376
diff
changeset
|
244 return self._repo |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
245 except (NotGitRepository, OSError), err: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
246 raise RepositoryError(err) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
247 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
248 def _get_all_revisions(self): |
2676
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
249 # we must check if this repo is not empty, since later command |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
250 # fails if it is. And it's cheaper to ask than throw the subprocess |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
251 # errors |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
252 try: |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
253 self._repo.head() |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
254 except KeyError: |
1f4d4b8d72f5
switched git_command to subprocession for non-blocking Popen.
Marcin Kuzminski <marcin@python-works.com>
parents:
2616
diff
changeset
|
255 return [] |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
256 |
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
257 rev_filter = _git_path = settings.GIT_REV_FILTER |
3561
c04d1d9b6193
made git refs filter configurable ref issue #797
Marcin Kuzminski <marcin@python-works.com>
parents:
3476
diff
changeset
|
258 cmd = 'rev-list %s --reverse --date-order' % (rev_filter) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
259 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
260 so, se = self.run_git_command(cmd) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
261 except RepositoryError: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
262 # Can be raised for empty repositories |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
263 return [] |
2535
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
264 return so.splitlines() |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
265 |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
266 def _get_all_revisions2(self): |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
267 #alternate implementation using dulwich |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
268 includes = [x[1][0] for x in self._parsed_refs.iteritems() |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
269 if x[1][1] != 'T'] |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
270 return [c.commit.id for c in self._repo.get_walker(include=includes)] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
271 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
272 def _get_revision(self, revision): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
273 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
274 For git backend we always return integer here. This way we ensure |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
275 that changset's revision attribute would become integer. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
276 """ |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
277 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
278 is_null = lambda o: len(o) == revision.count('0') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
279 |
3835
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
280 if self._empty: |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
281 raise EmptyRepositoryError("There are no changesets yet") |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
282 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
283 if revision in (None, '', 'tip', 'HEAD', 'head', -1): |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
284 return self.revisions[-1] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
285 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
286 is_bstr = isinstance(revision, (str, unicode)) |
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
287 if ((is_bstr and revision.isdigit() and len(revision) < 12) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
288 or isinstance(revision, int) or is_null(revision)): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
289 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
290 revision = self.revisions[int(revision)] |
3631
10b4e34841a4
Don't catch all exceptions
Marcin Kuzminski <marcin@python-works.com>
parents:
3579
diff
changeset
|
291 except Exception: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
292 msg = ("Revision %s does not exist for %s" % (revision, self)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
293 raise ChangesetDoesNotExistError(msg) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
294 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
295 elif is_bstr: |
2536
aaa41736ae51
Fixed lookup by Tag sha in git backend
Marcin Kuzminski <marcin@python-works.com>
parents:
2535
diff
changeset
|
296 # get by branch/tag name |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
297 _ref_revision = self._parsed_refs.get(revision) |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
298 if _ref_revision: # and _ref_revision[1] in ['H', 'RH', 'T']: |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
299 return _ref_revision[0] |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
300 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
301 _tags_shas = self.tags.values() |
2536
aaa41736ae51
Fixed lookup by Tag sha in git backend
Marcin Kuzminski <marcin@python-works.com>
parents:
2535
diff
changeset
|
302 # maybe it's a tag ? we don't have them in self.revisions |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
303 if revision in _tags_shas: |
2536
aaa41736ae51
Fixed lookup by Tag sha in git backend
Marcin Kuzminski <marcin@python-works.com>
parents:
2535
diff
changeset
|
304 return _tags_shas[_tags_shas.index(revision)] |
aaa41736ae51
Fixed lookup by Tag sha in git backend
Marcin Kuzminski <marcin@python-works.com>
parents:
2535
diff
changeset
|
305 |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
306 elif not SHA_PATTERN.match(revision) or revision not in self.revisions: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
307 msg = ("Revision %s does not exist for %s" % (revision, self)) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
308 raise ChangesetDoesNotExistError(msg) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
309 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
310 # Ensure we return full id |
3805
a5c234e934c5
synced with latest vcs
Marcin Kuzminski <marcin@python-works.com>
parents:
3797
diff
changeset
|
311 if not SHA_PATTERN.match(str(revision)): |
3575
ca7785fae354
avoid %r markup of unicode strings in user facing messages
Mads Kiilerich <madski@unity3d.com>
parents:
3574
diff
changeset
|
312 raise ChangesetDoesNotExistError("Given revision %s not recognized" |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
313 % revision) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
314 return revision |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
315 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
316 def _get_archives(self, archive_name='tip'): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
317 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
318 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
319 yield {"type": i[0], "extension": i[1], "node": archive_name} |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
320 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
321 def _get_url(self, url): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
322 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
323 Returns normalized url. If schema is not given, would fall to |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
324 filesystem (``file:///``) schema. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
325 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
326 url = str(url) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
327 if url != 'default' and not '://' in url: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
328 url = ':///'.join(('file', url)) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
329 return url |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
330 |
3456
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
331 def get_hook_location(self): |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
332 """ |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
333 returns absolute path to location where hooks are stored |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
334 """ |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
335 loc = os.path.join(self.path, 'hooks') |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
336 if not self.bare: |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
337 loc = os.path.join(self.path, '.git', 'hooks') |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
338 return loc |
cf1fbc9fed89
Added get_hook_location method for easier hook extraction
Marcin Kuzminski <marcin@python-works.com>
parents:
3397
diff
changeset
|
339 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
340 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
341 def name(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
342 return os.path.basename(self.path) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
343 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
344 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
345 def last_change(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
346 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
347 Returns last change made on this repository as datetime object |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
348 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
349 return date_fromtimestamp(self._get_mtime(), makedate()[1]) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
350 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
351 def _get_mtime(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
352 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
353 return time.mktime(self.get_changeset().date.timetuple()) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
354 except RepositoryError: |
2320
48d93ea1e245
fixed issues with support of bare-repos by vcs lib
Marcin Kuzminski <marcin@python-works.com>
parents:
2235
diff
changeset
|
355 idx_loc = '' if self.bare else '.git' |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
356 # fallback to filesystem |
2320
48d93ea1e245
fixed issues with support of bare-repos by vcs lib
Marcin Kuzminski <marcin@python-works.com>
parents:
2235
diff
changeset
|
357 in_path = os.path.join(self.path, idx_loc, "index") |
48d93ea1e245
fixed issues with support of bare-repos by vcs lib
Marcin Kuzminski <marcin@python-works.com>
parents:
2235
diff
changeset
|
358 he_path = os.path.join(self.path, idx_loc, "HEAD") |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
359 if os.path.exists(in_path): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
360 return os.stat(in_path).st_mtime |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
361 else: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
362 return os.stat(he_path).st_mtime |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
363 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
364 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
365 def description(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
366 undefined_description = u'unknown' |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
367 _desc = self._repo.get_description() |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
368 return safe_unicode(_desc or undefined_description) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
369 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
370 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
371 def contact(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
372 undefined_contact = u'Unknown' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
373 return undefined_contact |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
374 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
375 @property |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
376 def branches(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
377 if not self.revisions: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
378 return {} |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
379 sortkey = lambda ctx: ctx[0] |
2535
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
380 _branches = [(x[0], x[1][0]) |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
381 for x in self._parsed_refs.iteritems() if x[1][1] == 'H'] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
382 return OrderedDict(sorted(_branches, key=sortkey, reverse=False)) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
383 |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
384 @LazyProperty |
4020
218ed589e44a
branch selectors: show closed branches too
Mads Kiilerich <madski@unity3d.com>
parents:
3890
diff
changeset
|
385 def closed_branches(self): |
218ed589e44a
branch selectors: show closed branches too
Mads Kiilerich <madski@unity3d.com>
parents:
3890
diff
changeset
|
386 return {} |
218ed589e44a
branch selectors: show closed branches too
Mads Kiilerich <madski@unity3d.com>
parents:
3890
diff
changeset
|
387 |
218ed589e44a
branch selectors: show closed branches too
Mads Kiilerich <madski@unity3d.com>
parents:
3890
diff
changeset
|
388 @LazyProperty |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
389 def tags(self): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
390 return self._get_tags() |
2198
9784a54a0f5b
display current heads of branches for git in changelog and shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
2183
diff
changeset
|
391 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
392 def _get_tags(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
393 if not self.revisions: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
394 return {} |
2535
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
395 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
396 sortkey = lambda ctx: ctx[0] |
2535
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
397 _tags = [(x[0], x[1][0]) |
b24b1f0fa505
Get tags and branches using _parsed_refs
Marcin Kuzminski <marcin@python-works.com>
parents:
2453
diff
changeset
|
398 for x in self._parsed_refs.iteritems() if x[1][1] == 'T'] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
399 return OrderedDict(sorted(_tags, key=sortkey, reverse=True)) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
400 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
401 def tag(self, name, user, revision=None, message=None, date=None, |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
402 **kwargs): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
403 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
404 Creates and returns a tag for the given ``revision``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
405 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
406 :param name: name for new tag |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
407 :param user: full username, i.e.: "Joe Doe <joe.doe@example.com>" |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
408 :param revision: changeset id for which new tag would be created |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
409 :param message: message of the tag's commit |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
410 :param date: date of tag's commit |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
411 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
412 :raises TagAlreadyExistError: if tag with same name already exists |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
413 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
414 if name in self.tags: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
415 raise TagAlreadyExistError("Tag %s already exists" % name) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
416 changeset = self.get_changeset(revision) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
417 message = message or "Added tag %s for commit %s" % (name, |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
418 changeset.raw_id) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
419 self._repo.refs["refs/tags/%s" % name] = changeset._commit.id |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
420 |
2539
da18c423b100
Invalidate gits parsed_refs cache after commit, tagging or tag remove
Marcin Kuzminski <marcin@python-works.com>
parents:
2536
diff
changeset
|
421 self._parsed_refs = self._get_parsed_refs() |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
422 self.tags = self._get_tags() |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
423 return changeset |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
424 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
425 def remove_tag(self, name, user, message=None, date=None): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
426 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
427 Removes tag with the given ``name``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
428 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
429 :param name: name of the tag to be removed |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
430 :param user: full username, i.e.: "Joe Doe <joe.doe@example.com>" |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
431 :param message: message of the tag's removal commit |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
432 :param date: date of tag's removal commit |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
433 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
434 :raises TagDoesNotExistError: if tag with given name does not exists |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
435 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
436 if name not in self.tags: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
437 raise TagDoesNotExistError("Tag %s does not exist" % name) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
438 tagpath = posixpath.join(self._repo.refs.path, 'refs', 'tags', name) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
439 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
440 os.remove(tagpath) |
2539
da18c423b100
Invalidate gits parsed_refs cache after commit, tagging or tag remove
Marcin Kuzminski <marcin@python-works.com>
parents:
2536
diff
changeset
|
441 self._parsed_refs = self._get_parsed_refs() |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
442 self.tags = self._get_tags() |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
443 except OSError, e: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
444 raise RepositoryError(e.strerror) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
445 |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
446 @LazyProperty |
4088
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
447 def bookmarks(self): |
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
448 """ |
4089
a5888ca796b5
Fixed spelling of get's to gets
Marcin Kuzminski <marcin@python-works.com>
parents:
4088
diff
changeset
|
449 Gets bookmarks for this repository |
4088
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
450 """ |
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
451 return {} |
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
452 |
7c73f1868318
Add bookmarks property to git branch, it makes it consistent with other property
Marcin Kuzminski <marcin@python-works.com>
parents:
4020
diff
changeset
|
453 @LazyProperty |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
454 def _parsed_refs(self): |
2539
da18c423b100
Invalidate gits parsed_refs cache after commit, tagging or tag remove
Marcin Kuzminski <marcin@python-works.com>
parents:
2536
diff
changeset
|
455 return self._get_parsed_refs() |
da18c423b100
Invalidate gits parsed_refs cache after commit, tagging or tag remove
Marcin Kuzminski <marcin@python-works.com>
parents:
2536
diff
changeset
|
456 |
da18c423b100
Invalidate gits parsed_refs cache after commit, tagging or tag remove
Marcin Kuzminski <marcin@python-works.com>
parents:
2536
diff
changeset
|
457 def _get_parsed_refs(self): |
3579
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
458 # cache the property |
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
459 _repo = self._repo |
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
460 refs = _repo.get_refs() |
2453
d2a528b60e50
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2449
diff
changeset
|
461 keys = [('refs/heads/', 'H'), |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
462 ('refs/remotes/origin/', 'RH'), |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
463 ('refs/tags/', 'T')] |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
464 _refs = {} |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
465 for ref, sha in refs.iteritems(): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
466 for k, type_ in keys: |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
467 if ref.startswith(k): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
468 _key = ref[len(k):] |
2975
e0da2c0ecee1
fixes #625 Git-Tags are not displayed in Shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
2807
diff
changeset
|
469 if type_ == 'T': |
3579
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
470 obj = _repo.get_object(sha) |
2975
e0da2c0ecee1
fixes #625 Git-Tags are not displayed in Shortlog
Marcin Kuzminski <marcin@python-works.com>
parents:
2807
diff
changeset
|
471 if isinstance(obj, Tag): |
3579
11feddcd75bb
after hooks cleanup we don't need to have ui injections into repo so we don't need to cache git repos
Marcin Kuzminski <marcin@python-works.com>
parents:
3577
diff
changeset
|
472 sha = _repo.get_object(sha).object[1] |
2449
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
473 _refs[_key] = [sha, type_] |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
474 break |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
475 return _refs |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
476 |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
477 def _heads(self, reverse=False): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
478 refs = self._repo.get_refs() |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
479 heads = {} |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
480 |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
481 for key, val in refs.items(): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
482 for ref_key in ['refs/heads/', 'refs/remotes/origin/']: |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
483 if key.startswith(ref_key): |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
484 n = key[len(ref_key):] |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
485 if n not in ['HEAD']: |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
486 heads[n] = val |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
487 |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
488 return heads if reverse else dict((y, x) for x, y in heads.iteritems()) |
08fc67c1c948
added discovery by branches and tags for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2384
diff
changeset
|
489 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
490 def get_changeset(self, revision=None): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
491 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
492 Returns ``GitChangeset`` object representing commit from git repository |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
493 at the given revision or head (most recent commit) if None given. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
494 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
495 if isinstance(revision, GitChangeset): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
496 return revision |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
497 revision = self._get_revision(revision) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
498 changeset = GitChangeset(repository=self, revision=revision) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
499 return changeset |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
500 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
501 def get_changesets(self, start=None, end=None, start_date=None, |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
502 end_date=None, branch_name=None, reverse=False): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
503 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
504 Returns iterator of ``GitChangeset`` objects from start to end (both |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
505 are inclusive), in ascending date order (unless ``reverse`` is set). |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
506 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
507 :param start: changeset ID, as str; first returned changeset |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
508 :param end: changeset ID, as str; last returned changeset |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
509 :param start_date: if specified, changesets with commit date less than |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
510 ``start_date`` would be filtered out from returned set |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
511 :param end_date: if specified, changesets with commit date greater than |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
512 ``end_date`` would be filtered out from returned set |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
513 :param branch_name: if specified, changesets not reachable from given |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
514 branch would be filtered out from returned set |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
515 :param reverse: if ``True``, returned generator would be reversed |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
516 (meaning that returned changesets would have descending date order) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
517 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
518 :raise BranchDoesNotExistError: If given ``branch_name`` does not |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
519 exist. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
520 :raise ChangesetDoesNotExistError: If changeset for given ``start`` or |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
521 ``end`` could not be found. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
522 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
523 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
524 if branch_name and branch_name not in self.branches: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
525 raise BranchDoesNotExistError("Branch '%s' not found" \ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
526 % branch_name) |
3835
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
527 # actually we should check now if it's not an empty repo to not spaw |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
528 # subprocess commands |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
529 if self._empty: |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
530 raise EmptyRepositoryError("There are no changesets yet") |
42981614c624
vcs: fixed issues with calling get_changesets method doesn't
Marcin Kuzminski <marcin@python-works.com>
parents:
3830
diff
changeset
|
531 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
532 # %H at format means (full) commit hash, initial hashes are retrieved |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
533 # in ascending date order |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
534 cmd_template = 'log --date-order --reverse --pretty=format:"%H"' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
535 cmd_params = {} |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
536 if start_date: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
537 cmd_template += ' --since "$since"' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
538 cmd_params['since'] = start_date.strftime('%m/%d/%y %H:%M:%S') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
539 if end_date: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
540 cmd_template += ' --until "$until"' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
541 cmd_params['until'] = end_date.strftime('%m/%d/%y %H:%M:%S') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
542 if branch_name: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
543 cmd_template += ' $branch_name' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
544 cmd_params['branch_name'] = branch_name |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
545 else: |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
546 rev_filter = _git_path = settings.GIT_REV_FILTER |
3561
c04d1d9b6193
made git refs filter configurable ref issue #797
Marcin Kuzminski <marcin@python-works.com>
parents:
3476
diff
changeset
|
547 cmd_template += ' %s' % (rev_filter) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
548 |
3797
d7488551578e
synced vcs with upstream
Marcin Kuzminski <marcin@python-works.com>
parents:
3747
diff
changeset
|
549 cmd = string.Template(cmd_template).safe_substitute(**cmd_params) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
550 revs = self.run_git_command(cmd)[0].splitlines() |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
551 start_pos = 0 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
552 end_pos = len(revs) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
553 if start: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
554 _start = self._get_revision(start) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
555 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
556 start_pos = revs.index(_start) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
557 except ValueError: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
558 pass |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
559 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
560 if end is not None: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
561 _end = self._get_revision(end) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
562 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
563 end_pos = revs.index(_end) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
564 except ValueError: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
565 pass |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
566 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
567 if None not in [start, end] and start_pos > end_pos: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
568 raise RepositoryError('start cannot be after end') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
569 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
570 if end_pos is not None: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
571 end_pos += 1 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
572 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
573 revs = revs[start_pos:end_pos] |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
574 if reverse: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
575 revs = reversed(revs) |
3747
600ffde2634c
changelog pagination with branch filtering now uses
Marcin Kuzminski <marcin@python-works.com>
parents:
3631
diff
changeset
|
576 return CollectionGenerator(self, revs) |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
577 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
578 def get_diff(self, rev1, rev2, path=None, ignore_whitespace=False, |
2233
07fce1930417
fixed issues with gitsubmodule diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
2210
diff
changeset
|
579 context=3): |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
580 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
581 Returns (git like) *diff*, as plain text. Shows changes introduced by |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
582 ``rev2`` since ``rev1``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
583 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
584 :param rev1: Entry point from which diff is shown. Can be |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
585 ``self.EMPTY_CHANGESET`` - in this case, patch showing all |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
586 the changes since empty state of the repository until ``rev2`` |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
587 :param rev2: Until which revision changes should be shown. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
588 :param ignore_whitespace: If set to ``True``, would not show whitespace |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
589 changes. Defaults to ``False``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
590 :param context: How many lines before/after changed lines should be |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
591 shown. Defaults to ``3``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
592 """ |
2995
32471bd1f4ee
Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
2975
diff
changeset
|
593 flags = ['-U%s' % context, '--full-index', '--binary', '-p', '-M', '--abbrev=40'] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
594 if ignore_whitespace: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
595 flags.append('-w') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
596 |
2384
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
597 if hasattr(rev1, 'raw_id'): |
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
598 rev1 = getattr(rev1, 'raw_id') |
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
599 |
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
600 if hasattr(rev2, 'raw_id'): |
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
601 rev2 = getattr(rev2, 'raw_id') |
5563af834d92
Added diff option into git and hg changeset objects, representing git formated patch against parent1
Marcin Kuzminski <marcin@python-works.com>
parents:
2383
diff
changeset
|
602 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
603 if rev1 == self.EMPTY_CHANGESET: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
604 rev2 = self.get_changeset(rev2).raw_id |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
605 cmd = ' '.join(['show'] + flags + [rev2]) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
606 else: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
607 rev1 = self.get_changeset(rev1).raw_id |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
608 rev2 = self.get_changeset(rev2).raw_id |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
609 cmd = ' '.join(['diff'] + flags + [rev1, rev2]) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
610 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
611 if path: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
612 cmd += ' -- "%s"' % path |
2995
32471bd1f4ee
Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
2975
diff
changeset
|
613 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
614 stdout, stderr = self.run_git_command(cmd) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
615 # If we used 'show' command, strip first few lines (until actual diff |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
616 # starts) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
617 if rev1 == self.EMPTY_CHANGESET: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
618 lines = stdout.splitlines() |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
619 x = 0 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
620 for line in lines: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
621 if line.startswith('diff'): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
622 break |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
623 x += 1 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
624 # Append new line just like 'diff' command do |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
625 stdout = '\n'.join(lines[x:]) + '\n' |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
626 return stdout |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
627 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
628 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
629 def in_memory_changeset(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
630 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
631 Returns ``GitInMemoryChangeset`` object for this repository. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
632 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
633 return GitInMemoryChangeset(self) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
634 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
635 def clone(self, url, update_after_clone=True, bare=False): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
636 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
637 Tries to clone changes from external location. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
638 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
639 :param update_after_clone: If set to ``False``, git won't checkout |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
640 working directory |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
641 :param bare: If set to ``True``, repository would be cloned into |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
642 *bare* git repository (no working directory at all). |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
643 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
644 url = self._get_url(url) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
645 cmd = ['clone', '-q'] |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
646 if bare: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
647 cmd.append('--bare') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
648 elif not update_after_clone: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
649 cmd.append('--no-checkout') |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
650 cmd += ['--', '"%s"' % url, '"%s"' % self.path] |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
651 cmd = ' '.join(cmd) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
652 # If error occurs run_git_command raises RepositoryError already |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
653 self.run_git_command(cmd) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
654 |
2209
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
655 def pull(self, url): |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
656 """ |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
657 Tries to pull changes from external location. |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
658 """ |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
659 url = self._get_url(url) |
3890
f5a1314886ec
replace list appends with list literals when possible
Marcin Kuzminski <marcin@python-works.com>
parents:
3835
diff
changeset
|
660 cmd = ['pull', "--ff-only", url] |
2209
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
661 cmd = ' '.join(cmd) |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
662 # If error occurs run_git_command raises RepositoryError already |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
663 self.run_git_command(cmd) |
19a6c23af14b
Implemented pull command for remote repos for git
Marcin Kuzminski <marcin@python-works.com>
parents:
2200
diff
changeset
|
664 |
2383
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
665 def fetch(self, url): |
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
666 """ |
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
667 Tries to pull changes from external location. |
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
668 """ |
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
669 url = self._get_url(url) |
3178
a64e663abda3
fixed bad merge on git fetch fix
Marcin Kuzminski <marcin@python-works.com>
parents:
3157
diff
changeset
|
670 so, se = self.run_git_command('ls-remote -h %s' % url) |
3157
a73aca2075b8
fixed fetch command for git repos, now it properly fetches from remotes
Marcin Kuzminski <marcin@python-works.com>
parents:
3050
diff
changeset
|
671 refs = [] |
a73aca2075b8
fixed fetch command for git repos, now it properly fetches from remotes
Marcin Kuzminski <marcin@python-works.com>
parents:
3050
diff
changeset
|
672 for line in (x for x in so.splitlines()): |
a73aca2075b8
fixed fetch command for git repos, now it properly fetches from remotes
Marcin Kuzminski <marcin@python-works.com>
parents:
3050
diff
changeset
|
673 sha, ref = line.split('\t') |
a73aca2075b8
fixed fetch command for git repos, now it properly fetches from remotes
Marcin Kuzminski <marcin@python-works.com>
parents:
3050
diff
changeset
|
674 refs.append(ref) |
a73aca2075b8
fixed fetch command for git repos, now it properly fetches from remotes
Marcin Kuzminski <marcin@python-works.com>
parents:
3050
diff
changeset
|
675 refs = ' '.join(('+%s:%s' % (r, r) for r in refs)) |
3178
a64e663abda3
fixed bad merge on git fetch fix
Marcin Kuzminski <marcin@python-works.com>
parents:
3157
diff
changeset
|
676 cmd = '''fetch %s -- %s''' % (url, refs) |
2383
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
677 self.run_git_command(cmd) |
e576410f911d
Don't do git pull on remote repos since they are bare now, we need to use git fetch on them
Marcin Kuzminski <marcin@python-works.com>
parents:
2367
diff
changeset
|
678 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
679 def _update_server_info(self): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
680 """ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
681 runs gits update-server-info command in this repo instance |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
682 """ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
683 from dulwich.server import update_server_info |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
684 update_server_info(self._repo) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
685 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
686 @LazyProperty |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
687 def workdir(self): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
688 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
689 Returns ``Workdir`` instance for this repository. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
690 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
691 return GitWorkdir(self) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
692 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
693 def get_config_value(self, section, name, config_file=None): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
694 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
695 Returns configuration value for a given [``section``] and ``name``. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
696 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
697 :param section: Section we want to retrieve value from |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
698 :param name: Name of configuration we want to retrieve |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
699 :param config_file: A path to file which should be used to retrieve |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
700 configuration from (might also be a list of file paths) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
701 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
702 if config_file is None: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
703 config_file = [] |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
704 elif isinstance(config_file, basestring): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
705 config_file = [config_file] |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
706 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
707 def gen_configs(): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
708 for path in config_file + self._config_files: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
709 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
710 yield ConfigFile.from_path(path) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
711 except (IOError, OSError, ValueError): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
712 continue |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
713 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
714 for config in gen_configs(): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
715 try: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
716 return config.get(section, name) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
717 except KeyError: |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
718 continue |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
719 return None |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
720 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
721 def get_user_name(self, config_file=None): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
722 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
723 Returns user's name from global configuration file. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
724 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
725 :param config_file: A path to file which should be used to retrieve |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
726 configuration from (might also be a list of file paths) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
727 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
728 return self.get_config_value('user', 'name', config_file) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
729 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
730 def get_user_email(self, config_file=None): |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
731 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
732 Returns user's email from global configuration file. |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
733 |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
734 :param config_file: A path to file which should be used to retrieve |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
735 configuration from (might also be a list of file paths) |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
736 """ |
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
737 return self.get_config_value('user', 'email', config_file) |