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