comparison fetch_command.py @ 87:b033d74be76b

fetch_command: in stupid non-diffy mode, take changed paths in account Former code was checkouting all branch files for every converted revision when diffs were not available in stupid mode. Now, only changed items are requested.
author Patrick Mezard <pmezard@gmail.com>
date Fri, 14 Nov 2008 16:18:24 -0600
parents 2e47623fa174
children 3b60f223893a
comparison
equal deleted inserted replaced
86:6ecdbd22eb1d 87:b033d74be76b
293 293
294 Return a tuple (files, filectxfn) where 'files' is the list of all files 294 Return a tuple (files, filectxfn) where 'files' is the list of all files
295 in the branch at the given revision, and 'filectxfn' is a memctx compatible 295 in the branch at the given revision, and 'filectxfn' is a memctx compatible
296 callable to retrieve individual file information. 296 callable to retrieve individual file information.
297 """ 297 """
298 files = [] 298 parentctx = hg_editor.repo[parentid]
299 try: 299 kind = svn.checkpath(branchpath, r.revnum)
300 for path, kind in svn.list_files(branchpath, r.revnum): 300 if kind is None:
301 if kind == 'f':
302 files.append(path)
303 except IOError:
304 # Branch does not exist at this revision. Get parent revision and 301 # Branch does not exist at this revision. Get parent revision and
305 # remove everything. 302 # remove everything.
306 parentctx = hg_editor.repo[parentid]
307 files = parentctx.manifest().keys() 303 files = parentctx.manifest().keys()
308 def filectxfn(repo, memctx, path): 304 def filectxfn(repo, memctx, path):
309 raise IOError() 305 raise IOError()
310 return files, filectxfn 306 return files, filectxfn
307
308 files = []
309 branchprefix = branchpath + '/'
310 for path, e in r.paths.iteritems():
311 if not path.startswith(branchprefix):
312 continue
313 kind = svn.checkpath(path, r.revnum)
314 path = path[len(branchprefix):]
315 if kind == 'f':
316 files.append(path)
317 elif kind == 'd':
318 if e.action == 'M':
319 # Ignore property changes for now
320 continue
321 dirpath = branchprefix + path
322 for child, k in svn.list_files(dirpath, r.revnum):
323 if k == 'f':
324 files.append(path + '/' + child)
325 else:
326 if path in parentctx:
327 files.append(path)
328 continue
329 # Assume it's a deleted directory
330 path = path + '/'
331 deleted = [f for f in parentctx if f.startswith(path)]
332 files += deleted
311 333
312 copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentid) 334 copies = getcopies(svn, hg_editor, branch, branchpath, r, files, parentid)
313 335
314 linkprefix = 'link ' 336 linkprefix = 'link '
315 def filectxfn(repo, memctx, path): 337 def filectxfn(repo, memctx, path):