##// END OF EJS Templates
fixed description of update-repoinfo command
marcink -
r3334:968b2854 beta
parent child Browse files
Show More
@@ -1,87 +1,87
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 package.rhodecode.lib.cleanup
4 4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 :created_on: Jul 14, 2012
7 7 :author: marcink
8 8 :copyright: (C) 2010-2012 Marcin Kuzminski <marcin@python-works.com>
9 9 :license: GPLv3, see COPYING for more details.
10 10 """
11 11 # This program is free software: you can redistribute it and/or modify
12 12 # it under the terms of the GNU General Public License as published by
13 13 # the Free Software Foundation, either version 3 of the License, or
14 14 # (at your option) any later version.
15 15 #
16 16 # This program is distributed in the hope that it will be useful,
17 17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 19 # GNU General Public License for more details.
20 20 #
21 21 # You should have received a copy of the GNU General Public License
22 22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23 from __future__ import with_statement
24 24
25 25 import os
26 26 import sys
27 27 import re
28 28 import shutil
29 29 import logging
30 30 import datetime
31 31 import string
32 32
33 33 from os.path import dirname as dn, join as jn
34 34 from rhodecode.model import init_model
35 35 from rhodecode.lib.utils2 import engine_from_config
36 36 from rhodecode.model.db import Repository
37 37 from rhodecode.model.repo import RepoModel
38 38 from rhodecode.model.meta import Session
39 39
40 40
41 41 #to get the rhodecode import
42 42 sys.path.append(dn(dn(dn(os.path.realpath(__file__)))))
43 43
44 44 from rhodecode.lib.utils import BasePasterCommand, Command, add_cache
45 45
46 46 log = logging.getLogger(__name__)
47 47
48 48
49 49 class UpdateCommand(BasePasterCommand):
50 50
51 51 max_args = 1
52 52 min_args = 1
53 53
54 54 usage = "CONFIG_FILE"
55 summary = "Cleanup deleted repos"
55 summary = "Updates repositories caches for last changeset"
56 56 group_name = "RhodeCode"
57 57 takes_config_file = -1
58 58 parser = Command.standard_parser(verbose=True)
59 59
60 60 def command(self):
61 61 logging.config.fileConfig(self.path_to_ini_file)
62 62 from pylons import config
63 63
64 64 #get to remove repos !!
65 65 add_cache(config)
66 66 engine = engine_from_config(config, 'sqlalchemy.db1.')
67 67 init_model(engine)
68 68
69 69 repo_update_list = map(string.strip,
70 70 self.options.repo_update_list.split(',')) \
71 71 if self.options.repo_update_list else None
72 72
73 73 if repo_update_list:
74 74 repo_list = Repository.query()\
75 75 .filter(Repository.repo_name.in_(repo_update_list))
76 76 else:
77 77 repo_list = Repository.getAll()
78 78 RepoModel.update_repoinfo(repositories=repo_list)
79 79 Session().commit()
80 80
81 81 def update_parser(self):
82 82 self.parser.add_option('--update-only',
83 83 action='store',
84 84 dest='repo_update_list',
85 85 help="Specifies a comma separated list of repositores "
86 86 "to update last commit info for. OPTIONAL",
87 87 )
General Comments 0
You need to be logged in to leave comments. Login now