How to keep changesets in phase “draft” on hg push?
Asked Answered
P

4

4

How can I hinder mercurial from putting changesets to phase “public” on push operations? I want them to stay “draft”.

I rebase and histedit a lot, and the repository I push to is for me only. And having to change the phase all the time is a nuisance.

Plast answered 29/5, 2016 at 18:33 Comment(0)
P
11

What the documentation does not clearly reveal is:

The phase-change on push is not a purely local decision. – After “uploading” the changesets, the client asks the server for updates regarding the phases of the commits, and the server is usually telling that they are now “public”.

Thus, the .hgrc-snippet

[phases]
publish = False

has to be put on the server, which inhibits the usual phase-change there. The server will then report the phases back the same way they were pushed.

Bitbucket has an option for this under Settings → Repository details → Phases.

Plast answered 29/5, 2016 at 21:6 Comment(0)
W
4

The most direct way to keep the phase at draft is to configure the remote server as "non-publishing", as you have already discovered.

But there is a second way, which may be useful to some if the destination server cannot be set to "non-publishing" for any reason: Use pull instead of push. Pulling is read-only, so if you can set up your workflow (e.g. through a local alias) so that the remote pulls changes from your local repo, they'll remain in phase draft.

Wilmington answered 4/6, 2016 at 15:11 Comment(5)
you suggestion to use 'pull' worked for me. I tried the "non-publishing" setting listed above but it didn't work for me. Now my 'draft' stays that way on the server.Ilona
How do you push in such a way that the remote pulls from you?Biostatics
You don't push, you ssh to the remote and pull from there. Interactively or with a script.Wilmington
Most hosts which don’t let you edit the remote’s .hg/hgrc also don’t allow you an interactive shell or command other than hg serve. I thought there was maybe some trick to make hg push operate in pull mode, like how hg clone has both a hardlink mode and pull mode. Hmm, too bad.Biostatics
Well yeah, you need to have some control over the destination server. My suggestion is useful if you don't want to reconfigure the destination server, e.g. because it should behave as a publishing server except in this one case. (And by the way you know you can also use hg phase -f --draft to rewind the phase of some changesets to draft, right?)Wilmington
C
2

https://www.mercurial-scm.org/wiki/Phases

A repository is "publishing" by default. To make a repository non-publishing, add these lines to its hgrc configuration:


[phases]
publish = False
Connubial answered 29/5, 2016 at 19:13 Comment(4)
Okay. Try to push second head, remove it later in local repo and push this change to remote!Frampton
@LazyBadger: For what?Plast
@RobertSiemer - well, one of cases for "rewriting history" - I just found it by accident, when tested storm's easy wayFrampton
@LazyBadger Yes, problematic.Connubial
F
-1

Short answer: nohow

If you want rewrite history both locally and on push-target, you have to

Frampton answered 29/5, 2016 at 19:14 Comment(3)
I don’t want to rewrite on the push-target.Plast
@RobertSiemer - you want, rewriting on local only doesn't have senseFrampton
Yeah, I do want to, but that is not part of the question.Plast

© 2022 - 2024 — McMap. All rights reserved.