Details
Details
- Reviewers
stash - Group Reviewers
Restricted Project - Commits
- rFBHGX4e584d8a6a14: pushrebase: move bookmarks as well
Diff Detail
Diff Detail
- Repository
- rFBHGX Facebook Mercurial Extensions
- Lint
Lint Skipped - Unit
Unit Tests Skipped
stash |
Restricted Project |
Lint Skipped |
Unit Tests Skipped |
with ui.configoverride(overrides, 'pushrebase'): | with ui.configoverride(overrides, 'pushrebase'): | ||||
result = orig(ui, repo, *args, **opts) | result = orig(ui, repo, *args, **opts) | ||||
finally: | finally: | ||||
if onto: | if onto: | ||||
unwrapfunction(exchange, '_localphasemove', _phasemove) | unwrapfunction(exchange, '_localphasemove', _phasemove) | ||||
unwrapfunction(obsolete.obsstore, 'mergemarkers', _mergemarkers) | unwrapfunction(obsolete.obsstore, 'mergemarkers', _mergemarkers) | ||||
mapping = getattr(repo.obsstore, '_pushrebasereplaces', {}) | mapping = getattr(repo.obsstore, '_pushrebasereplaces', {}) | ||||
if mapping: | |||||
with repo.wlock(), repo.lock(), repo.transaction('push') as tr: | |||||
# move working copy parent | |||||
if wnode in mapping: | if wnode in mapping: | ||||
with repo.wlock(): | |||||
hg.update(repo, mapping[wnode]) | hg.update(repo, mapping[wnode]) | ||||
# move bookmarks | |||||
bmarks = repo._bookmarks | |||||
bmarkchanges = [] | |||||
for oldnode, newnode in mapping.items(): | |||||
bmarkchanges.extend((name, newnode) | |||||
for name in repo.nodebookmarks(oldnode)) | |||||
if bmarkchanges: | |||||
bmarks.applychanges(repo, tr, bmarkchanges) | |||||
return result | return result | ||||
def _mergemarkers(orig, self, transaction, data): | def _mergemarkers(orig, self, transaction, data): | ||||
"""record new markers so we could know the correct nodes for _phasemove""" | """record new markers so we could know the correct nodes for _phasemove""" | ||||
version, markers = obsolete._readmarkers(data) | version, markers = obsolete._readmarkers(data) | ||||
self._pushrebasereplaces = {} | self._pushrebasereplaces = {} | ||||
if version == obsolete._fm1version: | if version == obsolete._fm1version: |
$ hg commit -m a2 | $ hg commit -m a2 | ||||
$ cat >> .hg/hgrc <<EOF | $ cat >> .hg/hgrc <<EOF | ||||
> [experimental] | > [experimental] | ||||
> evolution = all | > evolution = all | ||||
> [paths] | > [paths] | ||||
> default = ../server1 | > default = ../server1 | ||||
> EOF | > EOF | ||||
$ hg book -i BOOK | |||||
$ hg push -r . --to default | $ hg push -r . --to default | ||||
pushing to $TESTTMP/server1 (glob) | pushing to $TESTTMP/server1 (glob) | ||||
searching for changes | searching for changes | ||||
pushing 1 changset: | pushing 1 changset: | ||||
045279cde9f0 a2 | 045279cde9f0 a2 | ||||
2 new changesets from the server will be downloaded | 2 new changesets from the server will be downloaded | ||||
adding changesets | adding changesets | ||||
adding manifests | adding manifests | ||||
adding file changes | adding file changes | ||||
added 2 changesets with 1 changes to 2 files (+1 heads) | added 2 changesets with 1 changes to 2 files (+1 heads) | ||||
1 new obsolescence markers | 1 new obsolescence markers | ||||
obsoleted 1 changesets | obsoleted 1 changesets | ||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | ||||
$ hg up tip -q | $ hg up tip -q | ||||
$ log --hidden | $ log --hidden | ||||
@ a2 [public:722505d780e3] | @ a2 [public:722505d780e3] BOOK | ||||
| | | | ||||
o b [public:d2ae7f538514] | o b [public:d2ae7f538514] | ||||
| | | | ||||
| x a2 [draft:045279cde9f0] | | x a2 [draft:045279cde9f0] | ||||
|/ | |/ | ||||
o a [public:cb9a9f314b8b] | o a [public:cb9a9f314b8b] | ||||
$ log | |||||
@ a2 [public:722505d780e3] BOOK | |||||
| | |||||
o b [public:d2ae7f538514] | |||||
| | |||||
o a [public:cb9a9f314b8b] | |||||