4005 except error.CapabilityError: |
4005 except error.CapabilityError: |
4006 err = _("other repository doesn't support revision lookup, " |
4006 err = _("other repository doesn't support revision lookup, " |
4007 "so a rev cannot be specified.") |
4007 "so a rev cannot be specified.") |
4008 raise error.Abort(err) |
4008 raise error.Abort(err) |
4009 |
4009 |
4010 pullopargs.update(opts.get('opargs', {})) |
4010 wlock = util.nullcontextmanager() |
4011 modheads = exchange.pull(repo, other, heads=revs, |
4011 if opts.get('update'): |
4012 force=opts.get('force'), |
4012 wlock = repo.wlock() |
4013 bookmarks=opts.get('bookmark', ()), |
4013 with wlock: |
4014 opargs=pullopargs).cgresult |
4014 pullopargs.update(opts.get('opargs', {})) |
4015 |
4015 modheads = exchange.pull(repo, other, heads=revs, |
4016 # brev is a name, which might be a bookmark to be activated at |
4016 force=opts.get('force'), |
4017 # the end of the update. In other words, it is an explicit |
4017 bookmarks=opts.get('bookmark', ()), |
4018 # destination of the update |
4018 opargs=pullopargs).cgresult |
4019 brev = None |
4019 |
4020 |
4020 # brev is a name, which might be a bookmark to be activated at |
4021 if checkout: |
4021 # the end of the update. In other words, it is an explicit |
4022 checkout = str(repo.changelog.rev(checkout)) |
4022 # destination of the update |
4023 |
4023 brev = None |
4024 # order below depends on implementation of |
4024 |
4025 # hg.addbranchrevs(). opts['bookmark'] is ignored, |
4025 if checkout: |
4026 # because 'checkout' is determined without it. |
4026 checkout = str(repo.changelog.rev(checkout)) |
4027 if opts.get('rev'): |
4027 |
4028 brev = opts['rev'][0] |
4028 # order below depends on implementation of |
4029 elif opts.get('branch'): |
4029 # hg.addbranchrevs(). opts['bookmark'] is ignored, |
4030 brev = opts['branch'][0] |
4030 # because 'checkout' is determined without it. |
4031 else: |
4031 if opts.get('rev'): |
4032 brev = branches[0] |
4032 brev = opts['rev'][0] |
4033 repo._subtoppath = source |
4033 elif opts.get('branch'): |
4034 try: |
4034 brev = opts['branch'][0] |
4035 ret = postincoming(ui, repo, modheads, opts.get('update'), |
4035 else: |
4036 checkout, brev) |
4036 brev = branches[0] |
4037 |
4037 repo._subtoppath = source |
4038 finally: |
4038 try: |
4039 del repo._subtoppath |
4039 ret = postincoming(ui, repo, modheads, opts.get('update'), |
|
4040 checkout, brev) |
|
4041 |
|
4042 finally: |
|
4043 del repo._subtoppath |
4040 |
4044 |
4041 finally: |
4045 finally: |
4042 other.close() |
4046 other.close() |
4043 return ret |
4047 return ret |
4044 |
4048 |