Rakefiles: propagate phase-changes back to staging repository
When pusshing changes to upstream, a changesets' phase may change
(from draft to public). These phase-changes need to be propagated
back to 'staging' repository so it cannot ve changed anymore.
--- a/rakelib/workflow.rake Mon Jun 27 15:13:20 2022 +0100
+++ b/rakelib/workflow.rake Mon Jun 27 15:27:52 2022 +0100
@@ -69,6 +69,19 @@
if not STDIN.tty? or (has_changes_in_this_repo and yesNO("Push to #{remote_url}")) then
(push_bookmark && bookmark) ? (opts[:bookmarks] = ['.']) : (opts[:rev] = '.') # bookmark can be uninitialized
hg.push(remote, **opts)
+ if remote == 'upstream' and paths['default'] then
+ # If we're pushing changes to the upstream, it may happen
+ # that the push changed phases (from draft to public). We need
+ # to propagate this phase changes back to upstream repo, so
+ # we:
+ #
+ # (i) do first a pull from upstream to get phase-changes back
+ # to local repo:
+ hg.pull(remote, rev: hg.branch)
+ # (ii) and then push back into 'defaut' to get phase-changes from
+ # local repo to staging repo:
+ hg.push('default', **opts)
+ end
has_changes = true
end
end