Show More
@@ -4082,26 +4082,13 b' def push(ui, repo, dest=None, **opts):' | |||||
4082 | finally: |
|
4082 | finally: | |
4083 | del repo._subtoppath |
|
4083 | del repo._subtoppath | |
4084 |
|
4084 | |||
4085 | pushvars = opts.get('pushvars') |
|
4085 | opargs = dict(opts.get('opargs', {})) # copy opargs since we may mutate it | |
4086 | if pushvars: |
|
4086 | opargs.setdefault('pushvars', []).extend(opts.get('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 |
|
|||
4097 |
|
4087 | |||
4098 | pushop = exchange.push(repo, other, opts.get('force'), revs=revs, |
|
4088 | pushop = exchange.push(repo, other, opts.get('force'), revs=revs, | |
4099 | newbranch=opts.get('new_branch'), |
|
4089 | newbranch=opts.get('new_branch'), | |
4100 | bookmarks=opts.get('bookmark', ()), |
|
4090 | bookmarks=opts.get('bookmark', ()), | |
4101 |
opargs= |
|
4091 | opargs=opargs) | |
4102 |
|
||||
4103 | if pushvars: |
|
|||
4104 | del repo._shellvars |
|
|||
4105 |
|
4092 | |||
4106 | result = not pushop.cgresult |
|
4093 | result = not pushop.cgresult | |
4107 |
|
4094 |
@@ -294,7 +294,7 b' class pushoperation(object):' | |||||
294 | """ |
|
294 | """ | |
295 |
|
295 | |||
296 | def __init__(self, repo, remote, force=False, revs=None, newbranch=False, |
|
296 | def __init__(self, repo, remote, force=False, revs=None, newbranch=False, | |
297 | bookmarks=()): |
|
297 | bookmarks=(), pushvars=None): | |
298 | # repo we push from |
|
298 | # repo we push from | |
299 | self.repo = repo |
|
299 | self.repo = repo | |
300 | self.ui = repo.ui |
|
300 | self.ui = repo.ui | |
@@ -352,6 +352,8 b' class pushoperation(object):' | |||||
352 | # map { pushkey partid -> callback handling failure} |
|
352 | # map { pushkey partid -> callback handling failure} | |
353 | # used to handle exception from mandatory pushkey part failure |
|
353 | # used to handle exception from mandatory pushkey part failure | |
354 | self.pkfailcb = {} |
|
354 | self.pkfailcb = {} | |
|
355 | # an iterable of pushvars or None | |||
|
356 | self.pushvars = pushvars | |||
355 |
|
357 | |||
356 | @util.propertycache |
|
358 | @util.propertycache | |
357 | def futureheads(self): |
|
359 | def futureheads(self): | |
@@ -876,10 +878,20 b' def _pushb2bookmarks(pushop, bundler):' | |||||
876 | @b2partsgenerator('pushvars', idx=0) |
|
878 | @b2partsgenerator('pushvars', idx=0) | |
877 | def _getbundlesendvars(pushop, bundler): |
|
879 | def _getbundlesendvars(pushop, bundler): | |
878 | '''send shellvars via bundle2''' |
|
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 | part = bundler.newpart('pushvars') |
|
892 | part = bundler.newpart('pushvars') | |
881 |
|
893 | |||
882 |
for key, value in |
|
894 | for key, value in shellvars.iteritems(): | |
883 | part.addparam(key, value, mandatory=False) |
|
895 | part.addparam(key, value, mandatory=False) | |
884 |
|
896 | |||
885 | def _pushbundle2(pushop): |
|
897 | def _pushbundle2(pushop): |
@@ -66,5 +66,6 b' Test pushing bad vars' | |||||
66 | $ hg commit -Aqm b |
|
66 | $ hg commit -Aqm b | |
67 | $ hg push --pushvars "DEBUG" |
|
67 | $ hg push --pushvars "DEBUG" | |
68 | pushing to $TESTTMP/repo (glob) |
|
68 | pushing to $TESTTMP/repo (glob) | |
|
69 | searching for changes | |||
69 | abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format |
|
70 | abort: unable to parse variable 'DEBUG', should follow 'KEY=VALUE' or 'KEY=' format | |
70 | [255] |
|
71 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now