Show More
@@ -16,7 +16,7 b' news' | |||
|
16 | 16 | - implemented #91 added nicer looking archive urls with more download options |
|
17 | 17 | like tags, branches |
|
18 | 18 | - implemented #44 into file browsing, and added follow branch option |
|
19 |
- implemented #84 downloads can be enabled/disabled for each repository |
|
|
19 | - implemented #84 downloads can be enabled/disabled for each repository | |
|
20 | 20 | - anonymous repository can be cloned without having to pass default:default |
|
21 | 21 | into clone url |
|
22 | 22 | - fixed #90 whoosh indexer can index chooses repositories passed in command |
@@ -50,6 +50,7 b' fixes' | |||
|
50 | 50 | - fixed strange issue on formencode imports |
|
51 | 51 | - fixed #126 Deleting repository on Windows, rename used incompatible chars. |
|
52 | 52 | - windows fixes for os.kill and path spliting, issues #148 and #133 |
|
53 | - #150 fixes for errors on repositories mapped in db but corrupted in filesystem | |
|
53 | 54 | |
|
54 | 55 | 1.1.7 (**2011-03-23**) |
|
55 | 56 | ====================== |
@@ -61,6 +61,7 b' class UserTemp(object):' | |||
|
61 | 61 | def __repr__(self): |
|
62 | 62 | return "<%s('id:%s')>" % (self.__class__.__name__, self.user_id) |
|
63 | 63 | |
|
64 | ||
|
64 | 65 | class RepoTemp(object): |
|
65 | 66 | def __init__(self, repo_id): |
|
66 | 67 | self.repo_id = repo_id |
@@ -68,6 +69,7 b' class RepoTemp(object):' | |||
|
68 | 69 | def __repr__(self): |
|
69 | 70 | return "<%s('id:%s')>" % (self.__class__.__name__, self.repo_id) |
|
70 | 71 | |
|
72 | ||
|
71 | 73 | class ScmModel(BaseModel): |
|
72 | 74 | """Generic Scm Model |
|
73 | 75 | """ |
@@ -98,7 +100,7 b' class ScmModel(BaseModel):' | |||
|
98 | 100 | |
|
99 | 101 | for name, path in get_filesystem_repos(repos_path, recursive=True): |
|
100 | 102 | try: |
|
101 |
if repos_list |
|
|
103 | if name in repos_list: | |
|
102 | 104 | raise RepositoryError('Duplicate repository name %s ' |
|
103 | 105 | 'found in %s' % (name, path)) |
|
104 | 106 | else: |
@@ -116,8 +118,8 b' class ScmModel(BaseModel):' | |||
|
116 | 118 | return repos_list |
|
117 | 119 | |
|
118 | 120 | def get_repos(self, all_repos=None): |
|
119 |
"""Get all repos from db and for each repo create it's |
|
|
120 | and fill that backed with information from database | |
|
121 | """Get all repos from db and for each repo create it's | |
|
122 | backend instance and fill that backed with information from database | |
|
121 | 123 | |
|
122 | 124 | :param all_repos: give specific repositories list, good for filtering |
|
123 | 125 | this have to be a list of just the repository names |
@@ -137,6 +139,9 b' class ScmModel(BaseModel):' | |||
|
137 | 139 | if r_dbr is not None: |
|
138 | 140 | repo, dbrepo = r_dbr |
|
139 | 141 | |
|
142 | if not repo and dbrepo: | |
|
143 | log.error('Repository %s looks somehow corrupted', r_name) | |
|
144 | continue | |
|
140 | 145 | last_change = repo.last_change |
|
141 | 146 | tip = h.get_changeset_safe(repo, 'tip') |
|
142 | 147 | |
@@ -146,7 +151,8 b' class ScmModel(BaseModel):' | |||
|
146 | 151 | tmp_d['description'] = dbrepo.description |
|
147 | 152 | tmp_d['description_sort'] = tmp_d['description'] |
|
148 | 153 | tmp_d['last_change'] = last_change |
|
149 |
tmp_d['last_change_sort'] = time.mktime(last_change |
|
|
154 | tmp_d['last_change_sort'] = time.mktime(last_change \ | |
|
155 | .timetuple()) | |
|
150 | 156 | tmp_d['tip'] = tip.raw_id |
|
151 | 157 | tmp_d['tip_sort'] = tip.revision |
|
152 | 158 | tmp_d['rev'] = tip.revision |
@@ -157,7 +163,8 b' class ScmModel(BaseModel):' | |||
|
157 | 163 | tmp_d['last_msg'] = tip.message |
|
158 | 164 | tmp_d['repo'] = repo |
|
159 | 165 | tmp_d['dbrepo'] = dbrepo.get_dict() |
|
160 |
tmp_d['dbrepo_fork'] = dbrepo.fork.get_dict() if dbrepo.fork |
|
|
166 | tmp_d['dbrepo_fork'] = dbrepo.fork.get_dict() if dbrepo.fork \ | |
|
167 | else {} | |
|
161 | 168 | yield tmp_d |
|
162 | 169 | |
|
163 | 170 | def get(self, repo_name, invalidation_list=None, retval='all'): |
@@ -228,7 +235,6 b' class ScmModel(BaseModel):' | |||
|
228 | 235 | dbr = RepoModel().get_full(repo_name, cache=True, |
|
229 | 236 | invalidate=dbinvalidate) |
|
230 | 237 | |
|
231 | ||
|
232 | 238 | return r, dbr |
|
233 | 239 | |
|
234 | 240 | def mark_for_invalidation(self, repo_name): |
@@ -256,7 +262,6 b' class ScmModel(BaseModel):' | |||
|
256 | 262 | log.error(traceback.format_exc()) |
|
257 | 263 | self.sa.rollback() |
|
258 | 264 | |
|
259 | ||
|
260 | 265 | def toggle_following_repo(self, follow_repo_id, user_id): |
|
261 | 266 | |
|
262 | 267 | f = self.sa.query(UserFollowing)\ |
@@ -277,7 +282,6 b' class ScmModel(BaseModel):' | |||
|
277 | 282 | self.sa.rollback() |
|
278 | 283 | raise |
|
279 | 284 | |
|
280 | ||
|
281 | 285 | try: |
|
282 | 286 | f = UserFollowing() |
|
283 | 287 | f.user_id = user_id |
@@ -292,7 +296,7 b' class ScmModel(BaseModel):' | |||
|
292 | 296 | self.sa.rollback() |
|
293 | 297 | raise |
|
294 | 298 | |
|
295 |
def toggle_following_user(self, follow_user_id |
|
|
299 | def toggle_following_user(self, follow_user_id, user_id): | |
|
296 | 300 | f = self.sa.query(UserFollowing)\ |
|
297 | 301 | .filter(UserFollowing.follows_user_id == follow_user_id)\ |
|
298 | 302 | .filter(UserFollowing.user_id == user_id).scalar() |
@@ -355,15 +359,14 b' class ScmModel(BaseModel):' | |||
|
355 | 359 | .filter(Repository.fork \ |
|
356 | 360 | == RepoModel().get_by_repo_name(repo_id)).count() |
|
357 | 361 | |
|
358 | ||
|
359 | 362 | def pull_changes(self, repo_name, username): |
|
360 | 363 | repo, dbrepo = self.get(repo_name, retval='all') |
|
361 | 364 | |
|
362 | 365 | try: |
|
363 | extras = {'ip':'', | |
|
364 | 'username':username, | |
|
365 | 'action':'push_remote', | |
|
366 | 'repository':repo_name} | |
|
366 | extras = {'ip': '', | |
|
367 | 'username': username, | |
|
368 | 'action': 'push_remote', | |
|
369 | 'repository': repo_name} | |
|
367 | 370 | |
|
368 | 371 | #inject ui extra param to log this action via push logger |
|
369 | 372 | for k, v in extras.items(): |
@@ -378,7 +381,6 b' class ScmModel(BaseModel):' | |||
|
378 | 381 | def get_unread_journal(self): |
|
379 | 382 | return self.sa.query(UserLog).count() |
|
380 | 383 | |
|
381 | ||
|
382 | 384 | def _should_invalidate(self, repo_name): |
|
383 | 385 | """Looks up database for invalidation signals for this repo_name |
|
384 | 386 |
General Comments 0
You need to be logged in to leave comments.
Login now