comparison fetch_command.py @ 186:6266ba36ee15

Create patch to make normal output much less verboseā€¦
author Dan Villiom Podlaski Christiansen <danchr@cs.au.dk>
date Sat, 17 Jan 2009 15:30:38 -0600
parents 57355b0e7bd1
children 68e506bc3a43
comparison
equal deleted inserted replaced
185:57355b0e7bd1 186:6266ba36ee15
77 # got a 502? Try more than once! 77 # got a 502? Try more than once!
78 tries = 0 78 tries = 0
79 converted = False 79 converted = False
80 while not converted and tries < 3: 80 while not converted and tries < 3:
81 try: 81 try:
82 ui.status('converting %s\n' % r) 82 ui.status(util.describe_revision(r))
83 if have_replay: 83 if have_replay:
84 try: 84 try:
85 replay_convert_rev(hg_editor, svn, r) 85 replay_convert_rev(hg_editor, svn, r)
86 except svnwrap.SubversionRepoCanNotReplay, e: #pragma: no cover 86 except svnwrap.SubversionRepoCanNotReplay, e: #pragma: no cover
87 ui.status('%s\n' % e.message) 87 ui.status('%s\n' % e.message)
121 hg_editor.ui.status('Fetching %s files that could not use replay.\n' % 121 hg_editor.ui.status('Fetching %s files that could not use replay.\n' %
122 len(hg_editor.missing_plaintexts)) 122 len(hg_editor.missing_plaintexts))
123 files_to_grab = set() 123 files_to_grab = set()
124 rootpath = svn.subdir and svn.subdir[1:] or '' 124 rootpath = svn.subdir and svn.subdir[1:] or ''
125 for p in hg_editor.missing_plaintexts: 125 for p in hg_editor.missing_plaintexts:
126 hg_editor.ui.status('.') 126 hg_editor.ui.note('.')
127 hg_editor.ui.flush() 127 hg_editor.ui.flush()
128 if p[-1] == '/': 128 if p[-1] == '/':
129 dirpath = p[len(rootpath):] 129 dirpath = p[len(rootpath):]
130 files_to_grab.update([dirpath + f for f,k in 130 files_to_grab.update([dirpath + f for f,k in
131 svn.list_files(dirpath, r.revnum) 131 svn.list_files(dirpath, r.revnum)
132 if k == 'f']) 132 if k == 'f'])
133 else: 133 else:
134 files_to_grab.add(p[len(rootpath):]) 134 files_to_grab.add(p[len(rootpath):])
135 hg_editor.ui.status('\nFetching files...\n') 135 hg_editor.ui.note('\nFetching files...\n')
136 for p in files_to_grab: 136 for p in files_to_grab:
137 hg_editor.ui.status('.') 137 hg_editor.ui.note('.')
138 hg_editor.ui.flush() 138 hg_editor.ui.flush()
139 cleanup_file_handles(svn, i) 139 cleanup_file_handles(svn, i)
140 i += 1 140 i += 1
141 data, mode = svn.get_file(p, r.revnum) 141 data, mode = svn.get_file(p, r.revnum)
142 hg_editor.set_file(p, data, 'x' in mode, 'l' in mode) 142 hg_editor.set_file(p, data, 'x' in mode, 'l' in mode)
143 hg_editor.missing_plaintexts = set() 143 hg_editor.missing_plaintexts = set()
144 hg_editor.ui.status('\n') 144 hg_editor.ui.note('\n')
145 hg_editor.commit_current_delta() 145 hg_editor.commit_current_delta()
146 146
147 147
148 binary_file_re = re.compile(r'''Index: ([^\n]*) 148 binary_file_re = re.compile(r'''Index: ([^\n]*)
149 =* 149 =*
266 # type stored and doesn't know a file is binary. It would 266 # type stored and doesn't know a file is binary. It would
267 # be better to do one file at a time and only do a 267 # be better to do one file at a time and only do a
268 # full fetch on files that had problems. 268 # full fetch on files that had problems.
269 raise BadPatchApply('patching failed') 269 raise BadPatchApply('patching failed')
270 for x in files_data.iterkeys(): 270 for x in files_data.iterkeys():
271 ui.status('M %s\n' % x) 271 ui.note('M %s\n' % x)
272 # if this patch didn't apply right, fall back to exporting the 272 # if this patch didn't apply right, fall back to exporting the
273 # entire rev. 273 # entire rev.
274 if patch_st == -1: 274 if patch_st == -1:
275 assert False, ('This should only happen on case-insensitive' 275 assert False, ('This should only happen on case-insensitive'
276 ' volumes.') 276 ' volumes.')
584 for f in files_touched: 584 for f in files_touched:
585 if f: 585 if f:
586 assert f[0] != '/' 586 assert f[0] != '/'
587 current_ctx = context.memctx(hg_editor.repo, 587 current_ctx = context.memctx(hg_editor.repo,
588 [parentctx.node(), revlog.nullid], 588 [parentctx.node(), revlog.nullid],
589 r.message or '...', 589 r.message or util.default_commit_msg,
590 files_touched, 590 files_touched,
591 filectxfn, 591 filectxfn,
592 hg_editor.authorforsvnauthor(r.author), 592 hg_editor.authorforsvnauthor(r.author),
593 date, 593 date,
594 extra) 594 extra)
595 ha = hg_editor.repo.commitctx(current_ctx) 595 ha = hg_editor.repo.commitctx(current_ctx)
596 hg_editor.add_to_revmap(r.revnum, b, ha) 596 hg_editor.add_to_revmap(r.revnum, b, ha)
597 hg_editor._save_metadata() 597 hg_editor._save_metadata()
598 ui.status('committed as %s on branch %s\n' % 598 ui.status(util.describe_commit(ha, b))
599 (node.hex(ha), b or 'default'))
600 # These are branches which would have an 'R' status in svn log. This means they were 599 # These are branches which would have an 'R' status in svn log. This means they were
601 # replaced by some other branch, so we need to verify they get marked as closed. 600 # replaced by some other branch, so we need to verify they get marked as closed.
602 for branch in check_deleted_branches: 601 for branch in check_deleted_branches:
603 branchedits = sorted(filter(lambda x: x[0][1] == branch and x[0][0] < r.revnum, 602 branchedits = sorted(filter(lambda x: x[0][1] == branch and x[0][0] < r.revnum,
604 hg_editor.revmap.iteritems()), reverse=True) 603 hg_editor.revmap.iteritems()), reverse=True)
622 if 'closed-branches' in hg_editor.repo.branchtags(): 621 if 'closed-branches' in hg_editor.repo.branchtags():
623 closed = hg_editor.repo['closed-branches'].node() 622 closed = hg_editor.repo['closed-branches'].node()
624 parents = (parent, closed) 623 parents = (parent, closed)
625 current_ctx = context.memctx(hg_editor.repo, 624 current_ctx = context.memctx(hg_editor.repo,
626 parents, 625 parents,
627 r.message or '...', 626 r.message or util.default_commit_msg,
628 files_touched, 627 files_touched,
629 filectxfn, 628 filectxfn,
630 hg_editor.authorforsvnauthor(r.author), 629 hg_editor.authorforsvnauthor(r.author),
631 date, 630 date,
632 {'branch': 'closed-branches'}) 631 {'branch': 'closed-branches'})