mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
infinitepush: log pushes to Scuba
Summary: This will allow us to efficiently identify scratch pushes that are not properly being pushed to both Mercurial and Mononoke. When we roll out `infinitepush-other`, this will be helpful to make sure all repositories are properly configured to push to both destinations. Reviewed By: farnz Differential Revision: D15577201 fbshipit-source-id: 17912b90a934f65ed21851170402ae498b127c14
This commit is contained in:
parent
d6c8fef226
commit
4a77a90d3c
@ -210,23 +210,34 @@ def _push(orig, ui, repo, dest=None, *args, **opts):
|
|||||||
_("default repository not configured!"),
|
_("default repository not configured!"),
|
||||||
hint=_("see 'hg help config.paths'"),
|
hint=_("see 'hg help config.paths'"),
|
||||||
)
|
)
|
||||||
dest = path.pushloc or path.loc
|
realdest = path.pushloc or path.loc
|
||||||
if dest.startswith("svn+") and scratchpush:
|
if realdest.startswith("svn+") and scratchpush:
|
||||||
raise error.Abort(
|
raise error.Abort(
|
||||||
"infinite push does not work with svn repo",
|
"infinite push does not work with svn repo",
|
||||||
hint="did you forget to `hg push default`?",
|
hint="did you forget to `hg push default`?",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
otherdest = otherpath and (otherpath.pushloc or otherpath.loc)
|
||||||
|
|
||||||
|
if scratchpush:
|
||||||
|
ui.log(
|
||||||
|
"infinitepush_destinations",
|
||||||
|
dest=dest,
|
||||||
|
real_dest=realdest,
|
||||||
|
other_dest=otherdest,
|
||||||
|
bookmark=bookmark,
|
||||||
|
)
|
||||||
|
|
||||||
# Remote scratch bookmarks will be deleted because remotenames doesn't
|
# Remote scratch bookmarks will be deleted because remotenames doesn't
|
||||||
# know about them. Let's save it before push and restore after
|
# know about them. Let's save it before push and restore after
|
||||||
remotescratchbookmarks = bookmarks.readremotebookmarks(ui, repo, dest)
|
remotescratchbookmarks = bookmarks.readremotebookmarks(ui, repo, realdest)
|
||||||
result = orig(ui, repo, dest, *args, **opts)
|
result = orig(ui, repo, realdest, *args, **opts)
|
||||||
|
|
||||||
# If an alternate Infinitepush destination is specified, replicate the
|
# If an alternate Infinitepush destination is specified, replicate the
|
||||||
# push there. This ensures scratch bookmarks (and their commits) can
|
# push there. This ensures scratch bookmarks (and their commits) can
|
||||||
# properly be replicated to Mononoke.
|
# properly be replicated to Mononoke.
|
||||||
if otherpath is not None:
|
|
||||||
otherdest = otherpath.pushloc or otherpath.loc
|
if otherdest is not None and otherdest != realdest:
|
||||||
if otherdest != dest:
|
|
||||||
m = _(
|
m = _(
|
||||||
"please wait while we replicate this push to an alternate repository\n"
|
"please wait while we replicate this push to an alternate repository\n"
|
||||||
)
|
)
|
||||||
@ -237,12 +248,12 @@ def _push(orig, ui, repo, dest=None, *args, **opts):
|
|||||||
|
|
||||||
if bookmarks.remotebookmarksenabled(ui):
|
if bookmarks.remotebookmarksenabled(ui):
|
||||||
if bookmark and scratchpush:
|
if bookmark and scratchpush:
|
||||||
other = hg.peer(repo, opts, dest)
|
other = hg.peer(repo, opts, realdest)
|
||||||
fetchedbookmarks = other.listkeyspatterns(
|
fetchedbookmarks = other.listkeyspatterns(
|
||||||
"bookmarks", patterns=[bookmark]
|
"bookmarks", patterns=[bookmark]
|
||||||
)
|
)
|
||||||
remotescratchbookmarks.update(fetchedbookmarks)
|
remotescratchbookmarks.update(fetchedbookmarks)
|
||||||
bookmarks.saveremotebookmarks(repo, remotescratchbookmarks, dest)
|
bookmarks.saveremotebookmarks(repo, remotescratchbookmarks, realdest)
|
||||||
if oldphasemove:
|
if oldphasemove:
|
||||||
exchange._localphasemove = oldphasemove
|
exchange._localphasemove = oldphasemove
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user