Details
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHG516b5a5edae3: exchange: use command executor for pushkey
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/debugcommands.py (9 lines) | |||
M | mercurial/exchange.py (23 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg | ||
Closed | indygreg |
With five args, set a key to new if it currently is set to old. | With five args, set a key to new if it currently is set to old. | ||||
Reports success or failure. | Reports success or failure. | ||||
''' | ''' | ||||
target = hg.peer(ui, {}, repopath) | target = hg.peer(ui, {}, repopath) | ||||
if keyinfo: | if keyinfo: | ||||
key, old, new = keyinfo | key, old, new = keyinfo | ||||
r = target.pushkey(namespace, key, old, new) | with target.commandexecutor() as e: | ||||
r = e.callcommand('pushkey', { | |||||
'namespace': namespace, | |||||
'key': key, | |||||
'old': old, | |||||
'new': new, | |||||
}).result() | |||||
ui.status(pycompat.bytestr(r) + '\n') | ui.status(pycompat.bytestr(r) + '\n') | ||||
return not r | return not r | ||||
else: | else: | ||||
for k, v in sorted(target.listkeys(namespace).iteritems()): | for k, v in sorted(target.listkeys(namespace).iteritems()): | ||||
ui.write("%s\t%s\n" % (stringutil.escapestr(k), | ui.write("%s\t%s\n" % (stringutil.escapestr(k), | ||||
stringutil.escapestr(v))) | stringutil.escapestr(v))) | ||||
@command('debugpvec', [], _('A B')) | @command('debugpvec', [], _('A B')) |
outdated = pushop.fallbackoutdatedphases | outdated = pushop.fallbackoutdatedphases | ||||
pushop.stepsdone.add('phases') | pushop.stepsdone.add('phases') | ||||
# filter heads already turned public by the push | # filter heads already turned public by the push | ||||
outdated = [c for c in outdated if c.node() not in pheads] | outdated = [c for c in outdated if c.node() not in pheads] | ||||
# fallback to independent pushkey command | # fallback to independent pushkey command | ||||
for newremotehead in outdated: | for newremotehead in outdated: | ||||
r = pushop.remote.pushkey('phases', | with pushop.remote.commandexecutor() as e: | ||||
newremotehead.hex(), | r = e.callcommand('pushkey', { | ||||
('%d' % phases.draft), | 'namespace': 'phases', | ||||
('%d' % phases.public)) | 'key': newremotehead.hex(), | ||||
'old': '%d' % phases.draft, | |||||
'new': '%d' % phases.public | |||||
}).result() | |||||
if not r: | if not r: | ||||
pushop.ui.warn(_('updating %s to public failed!\n') | pushop.ui.warn(_('updating %s to public failed!\n') | ||||
% newremotehead) | % newremotehead) | ||||
def _localphasemove(pushop, nodes, phase=phases.public): | def _localphasemove(pushop, nodes, phase=phases.public): | ||||
"""move <nodes> to <phase> in the local source repo""" | """move <nodes> to <phase> in the local source repo""" | ||||
if pushop.trmanager: | if pushop.trmanager: | ||||
phases.advanceboundary(pushop.repo, | phases.advanceboundary(pushop.repo, | ||||
remote = pushop.remote | remote = pushop.remote | ||||
for b, old, new in pushop.outbookmarks: | for b, old, new in pushop.outbookmarks: | ||||
action = 'update' | action = 'update' | ||||
if not old: | if not old: | ||||
action = 'export' | action = 'export' | ||||
elif not new: | elif not new: | ||||
action = 'delete' | action = 'delete' | ||||
if remote.pushkey('bookmarks', b, old, new): | |||||
with remote.commandexecutor() as e: | |||||
r = e.callcommand('pushkey', { | |||||
'namespace': 'bookmarks', | |||||
'key': b, | |||||
'old': old, | |||||
'new': new, | |||||
}).result() | |||||
if r: | |||||
ui.status(bookmsgmap[action][0] % b) | ui.status(bookmsgmap[action][0] % b) | ||||
else: | else: | ||||
ui.warn(bookmsgmap[action][1] % b) | ui.warn(bookmsgmap[action][1] % b) | ||||
# discovery can have set the value form invalid entry | # discovery can have set the value form invalid entry | ||||
if pushop.bkresult is not None: | if pushop.bkresult is not None: | ||||
pushop.bkresult = 1 | pushop.bkresult = 1 | ||||
class pulloperation(object): | class pulloperation(object): |