##// END OF EJS Templates
record: minimize number of status calls
Dirkjan Ochtman -
r7754:ab00d2c2 default
parent child Browse files
Show More
@@ -406,15 +406,10 b' def dorecord(ui, repo, committer, *pats,'
406 In the end we'll record intresting changes, and everything else will be
406 In the end we'll record intresting changes, and everything else will be
407 left in place, so the user can continue his work.
407 left in place, so the user can continue his work.
408 """
408 """
409 if match.files():
409
410 changes = None
410 changes = repo.status(match=match)[:3]
411 else:
412 changes = repo.status(match=match)[:3]
413 modified, added, removed = changes
414 match = cmdutil.matchfiles(repo, modified + added + removed)
415 diffopts = mdiff.diffopts(git=True, nodates=True)
411 diffopts = mdiff.diffopts(git=True, nodates=True)
416 chunks = patch.diff(repo, repo.dirstate.parents()[0], match=match,
412 chunks = patch.diff(repo, changes=changes, opts=diffopts)
417 changes=changes, opts=diffopts)
418 fp = cStringIO.StringIO()
413 fp = cStringIO.StringIO()
419 fp.write(''.join(chunks))
414 fp.write(''.join(chunks))
420 fp.seek(0)
415 fp.seek(0)
@@ -428,15 +423,12 b' def dorecord(ui, repo, committer, *pats,'
428 try: contenders.update(dict.fromkeys(h.files()))
423 try: contenders.update(dict.fromkeys(h.files()))
429 except AttributeError: pass
424 except AttributeError: pass
430
425
431 newfiles = [f for f in match.files() if f in contenders]
426 changed = changes[0] + changes[1] + changes[2]
432
427 newfiles = [f for f in changed if f in contenders]
433 if not newfiles:
428 if not newfiles:
434 ui.status(_('no changes to record\n'))
429 ui.status(_('no changes to record\n'))
435 return 0
430 return 0
436
431
437 if changes is None:
438 match = cmdutil.matchfiles(repo, newfiles)
439 changes = repo.status(match=match)
440 modified = dict.fromkeys(changes[0])
432 modified = dict.fromkeys(changes[0])
441
433
442 # 2. backup changed files, so we can restore them in the end
434 # 2. backup changed files, so we can restore them in the end
General Comments 0
You need to be logged in to leave comments. Login now