Show More
@@ -4082,26 +4082,13 b' def push(ui, repo, dest=None, **opts):' | |||
|
4082 | 4082 | finally: |
|
4083 | 4083 | del repo._subtoppath |
|
4084 | 4084 | |
|
4085 | pushvars = opts.get('pushvars') | |
|
4086 | if pushvars: | |
|
4087 | shellvars = {} | |
|
4088 | for raw in pushvars: | |
|
4089 | if '=' not in raw: | |
|
4090 | msg = ("unable to parse variable '%s', should follow " | |
|
4091 | "'KEY=VALUE' or 'KEY=' format") | |
|
4092 | raise error.Abort(msg % raw) | |
|
4093 | k, v = raw.split('=', 1) | |
|
4094 | shellvars[k] = v | |
|
4095 | ||
|
4096 | repo._shellvars = shellvars | |
|
4085 | opargs = dict(opts.get('opargs', {})) # copy opargs since we may mutate it | |
|
4086 | opargs.setdefault('pushvars', []).extend(opts.get('pushvars', [])) | |
|
4097 | 4087 | |
|
4098 | 4088 | pushop = exchange.push(repo, other, opts.get('force'), revs=revs, |
|
4099 | 4089 | newbranch=opts.get('new_branch'), |
|
4100 | 4090 | bookmarks=opts.get('bookmark', ()), |
|
4101 |
opargs= |
|
|
4102 | ||
|
4103 | if pushvars: | |
|
4104 | del repo._shellvars | |
|
4091 | opargs=opargs) | |
|
4105 | 4092 | |
|
4106 | 4093 | result = not pushop.cgresult |
|
4107 | 4094 |
@@ -294,7 +294,7 b' class pushoperation(object):' | |||
|
294 | 294 | """ |
|
295 | 295 | |
|
296 | 296 | def __init__(self, repo, remote, force=False, revs=None, newbranch=False, |
|
297 | bookmarks=()): | |
|
297 | bookmarks=(), pushvars=None): | |
|
298 | 298 | # repo we push from |
|
299 | 299 | self.repo = repo |
|
300 | 300 | self.ui = repo.ui |
@@ -352,6 +352,8 b' class pushoperation(object):' | |||
|
352 | 352 | # map { pushkey partid -> callback handling failure} |
|
353 | 353 | # used to handle exception from mandatory pushkey part failure |
|
354 | 354 | self.pkfailcb = {} |
|
355 | # an iterable of pushvars or None | |
|
356 | self.pushvars = pushvars | |
|
355 | 357 | |
|
356 | 358 | @util.propertycache |
|
357 | 359 | def futureheads(self): |
@@ -876,10 +878,20 b' def _pushb2bookmarks(pushop, bundler):' | |||
|
876 | 878 | @b2partsgenerator('pushvars', idx=0) |
|
877 | 879 | def _getbundlesendvars(pushop, bundler): |
|
878 | 880 | '''send shellvars via bundle2''' |
|
879 | if getattr(pushop.repo, '_shellvars', ()): | |
|
881 | pushvars = pushop.pushvars | |
|
882 | if pushvars: | |
|
883 | shellvars = {} | |
|
884 | for raw in pushvars: | |
|
885 | if '=' not in raw: | |
|
886 | msg = ("unable to parse variable '%s', should follow " | |
|
887 | "'KEY=VALUE' or 'KEY=' format") | |
|
888 | raise error.Abort(msg % raw) | |
|
889 | k, v = raw.split('=', 1) | |
|
890 | shellvars[k] = v | |
|
891 | ||
|
880 | 892 | part = bundler.newpart('pushvars') |
|
881 | 893 | |
|
882 |
for key, value in |
|
|
894 | for key, value in shellvars.iteritems(): | |
|
883 | 895 | part.addparam(key, value, mandatory=False) |
|
884 | 896 | |
|
885 | 897 | def _pushbundle2(pushop): |
General Comments 0
You need to be logged in to leave comments.
Login now