equal
deleted
inserted
replaced
3261 if (opts.get('exact') or not opts.get('force')) and update: |
3261 if (opts.get('exact') or not opts.get('force')) and update: |
3262 cmdutil.bailifchanged(repo) |
3262 cmdutil.bailifchanged(repo) |
3263 |
3263 |
3264 base = opts["base"] |
3264 base = opts["base"] |
3265 strip = opts["strip"] |
3265 strip = opts["strip"] |
3266 wlock = lock = None |
3266 wlock = lock = tr = None |
3267 msgs = [] |
3267 msgs = [] |
3268 |
3268 |
3269 def checkexact(repo, n, nodeid): |
3269 def checkexact(repo, n, nodeid): |
3270 if opts.get('exact') and hex(n) != nodeid: |
3270 if opts.get('exact') and hex(n) != nodeid: |
3271 repo.rollback() |
3271 repo.rollback() |
3332 m = scmutil.matchfiles(repo, files or []) |
3332 m = scmutil.matchfiles(repo, files or []) |
3333 n = repo.commit(message, opts.get('user') or user, |
3333 n = repo.commit(message, opts.get('user') or user, |
3334 opts.get('date') or date, match=m, |
3334 opts.get('date') or date, match=m, |
3335 editor=cmdutil.commiteditor) |
3335 editor=cmdutil.commiteditor) |
3336 checkexact(repo, n, nodeid) |
3336 checkexact(repo, n, nodeid) |
3337 # Force a dirstate write so that the next transaction |
|
3338 # backups an up-to-date file. |
|
3339 repo.dirstate.write() |
|
3340 else: |
3337 else: |
3341 if opts.get('exact') or opts.get('import_branch'): |
3338 if opts.get('exact') or opts.get('import_branch'): |
3342 branch = branch or 'default' |
3339 branch = branch or 'default' |
3343 else: |
3340 else: |
3344 branch = p1.branch() |
3341 branch = p1.branch() |
3368 os.unlink(tmpname) |
3365 os.unlink(tmpname) |
3369 |
3366 |
3370 try: |
3367 try: |
3371 wlock = repo.wlock() |
3368 wlock = repo.wlock() |
3372 lock = repo.lock() |
3369 lock = repo.lock() |
|
3370 tr = repo.transaction('import') |
3373 parents = repo.parents() |
3371 parents = repo.parents() |
3374 for patchurl in patches: |
3372 for patchurl in patches: |
3375 if patchurl == '-': |
3373 if patchurl == '-': |
3376 ui.status(_('applying patch from stdin\n')) |
3374 ui.status(_('applying patch from stdin\n')) |
3377 patchfile = ui.fin |
3375 patchfile = ui.fin |
3393 parents = [repo[node]] |
3391 parents = [repo[node]] |
3394 |
3392 |
3395 if not haspatch: |
3393 if not haspatch: |
3396 raise util.Abort(_('%s: no diffs found') % patchurl) |
3394 raise util.Abort(_('%s: no diffs found') % patchurl) |
3397 |
3395 |
|
3396 tr.close() |
3398 if msgs: |
3397 if msgs: |
3399 repo.savecommitmessage('\n* * *\n'.join(msgs)) |
3398 repo.savecommitmessage('\n* * *\n'.join(msgs)) |
|
3399 except: |
|
3400 # wlock.release() indirectly calls dirstate.write(): since |
|
3401 # we're crashing, we do not want to change the working dir |
|
3402 # parent after all, so make sure it writes nothing |
|
3403 repo.dirstate.invalidate() |
|
3404 raise |
3400 finally: |
3405 finally: |
|
3406 if tr: |
|
3407 tr.release() |
3401 release(lock, wlock) |
3408 release(lock, wlock) |
3402 |
3409 |
3403 @command('incoming|in', |
3410 @command('incoming|in', |
3404 [('f', 'force', None, |
3411 [('f', 'force', None, |
3405 _('run even if remote repository is unrelated')), |
3412 _('run even if remote repository is unrelated')), |