Draft commits on mercurial - mercurial

I have been committing regularly to a mercurial repo which is managed by Bitbucket. Today when I made a commit as I always do, Bitbucket has marked the commit as "draft" (this has never happened before). Any ideas what a draft commit is?

I see the same thing. It looks like there was a change implemented recently to support phases. I fixed this by going into the settings for my repo and 1) turning on "This is a non-publishing repository", 2) Saving, then 3) turning it back off. It may work for you.

A draft is part of the phases framework:
https://www.mercurial-scm.org/repo/hg/help/phases
I am not that familiar with this feature, but it would appear as if Bitbucket possibly changed some setting and is now marking public commits as draft.
I too noticed this, but in the last few minutes, it appears as if the system removed the draft label.

I had issue where TortoiseHG was marking some commits I had just pushed on master as draft. After confirming they had indeed made it to server I was able to simply right click on the commit and click "Change Phase to => Public"

Related

Mercurial: Pull changes from remote repository without public phase (non-publishing server, "abort: can't rebase immutable changeset")

Background
Mercurial now has Phases which are a great mechanism to keep people from altering history that should not be altered. When a changeset is pushed to remote repository it is made public and can no longer be rebased. This is normally a good thing, if the repository is public and you don't want others altering your changesets.
However, if you have your own temporary repository for sharing draft changesets only with yourself, it can get very annoying. Mercurial has a option to turn this off. Adding this to the .hg/hgrc file of the remote repository.
[phases]
publish = False
This will prevent changesets pushed to the remote repository from moving from draft phase to public phase (both the local changeset and the one just pushed to the remote repository. However, pulling this changeset down still will always pulls it down in the public phase.
Question
I am hoping to pull down changesets in the draft phase. I simply want to push a changeset to my personal server then pull it down at home. After I pull it I will rebase my temporary commit on top of any commits that I have pulled down from our true publishing server.
Any way to avoid the auto-moving of a pulled changeset to public would be great. This remote repository is a complete and total draft server for myself. Being forced to manually move the changesets back to draft after an unsuccessful rebase attempt is really starting to wear on the nerves.
References
https://www.mercurial-scm.org/wiki/Phases
Introduction to Mercurial Phases
How do I tell (locally) mercurial that a server is non-publishing?
After pushing to a review repository, "abort: can't rebase immutable changeset" on rebase
That seems like a bug. What version of Mercurial are you using? Have you tried filing a bug at https://bz.mercurial-scm.org ?
I got this resolved through help on Bugzilla. Here is a snippet of my final post there (thanks for putting me on the right track djc).
It looks like we can chalk it up to User Error/Bad Test Cases (of
course). If there is anyone to blame (besides myself) it could be
TortoiseHg. My test cases consisted of stripping commits and from one
of the two repositories and then changing the phase of that commit in
the other repository and push/pull again. It seems like TortoiseHg
would pull in the wrong phase sometimes (possibly a caching issue). I
can still reproduce this when I switch my server back and forth
between publishing and non-publishing (but not quite as consistently
before).
However, doing a command line pull seems to get it working every time.
I was using command line to check outgoing/incoming, do the phase
changes and such, but possibly never used it for the actual pull.
Sorry to waste everybody's time. I resolved it as invalid, not sure if
someone wants to change it to a better category. Let me know if there
is anything else you want me to check or expand upon.
I'll edit in any updates, let me know if anyone is still having trouble with this.

Mercurial: what are the consequences of changing a phase?

In Mercurial, the phase of a revision can be changed arbitrarily. What are the consequences of a phase change for all possible transitions (public, draft, secret) x (public, draft, secret)? Which phase changes are safe? Which may cause troubles and which kind of troubles? Which are more or less no-ops?
The default phase for a commit is draft, that's how they were treated when the phases didn't exist. When pushing a draft changeset, mercurial automatically changes its phase to public. You can use it to know which changesets you have already published or not.
But the real issue is that when the changeset is in public phase, mercurial won't let you change them with history editing extensions (like mq, rebase, etc). That's really important, because the history editing happens only in the local repository, they don't propagate with pull/push operations. So, once a changeset is published, it's out of control, it's dangerous to change it.
You can change from any phase to any other phase. The "normal flow" is to move to a higher phase (secret->draft->public), but Mercurial allows the change to a lower phase with the --force option. A phase change alone is harmless. For example, the only thing that happens when moving from public to draft or secret is that the protection of history editing is dropped, nothing else, pull and push will still work normally, Mercurial could never be confused about the changesets because they have unique identifiers. The history editing action that takes place after a phase change like this is what can cause problems. And that's why Mercurial gives the warning in the phase change and requires the --force option, as a confirmation that that's what you really want.
In general published commits shoudn't be modified, that's what the phases try to ensure. But maybe you do have control over all repositories. Or maybe you pushed something and you know that no one else pulled it yet. Whatever is the reason, you have the option of forcing the phase of the changesets back to draft and edit them. But this edition must be done in every repository that has the changesets.
A public revision can't be edited with history-editing tools (i.e. mq, rebase).
A secret revision can't be pushed to another repository (it will be ignored when you give the push command, or when another repository attempts to pull).
A draft revision allows both, but will automatically change to public if it gets pushed to another repository.
The purpose of the phase system is to prevent you from modifying a revision after you've pushed it to another repository, which is a bad idea unless you're able to delete the old version of the revision from all repositories that it's been pushed to.
All phase changes are more or less no-ops; it's just a marker to indicate what is or isn't safe to do with a revision.

What to do with an unused repository clone

This is mainly a Mercurial based question. Specifically Eclipse Mercurial.
After cloning the central repo, making the changes (branch, new feature, merge...), the clone on the desktop is idle and not necessary (it won't be used again, probably). What should be done with it? Right click, delete?
If the changes have been pushed back to the central repo and you won’t be using it again anytime soon, then yes there is no reason to keep it around.

HG: How to push some (but not all) changes to 'stable' branch?

Say I do my new feature development either in default, or an entirely new branch made just for the feature for a web site project. When it comes time to push the feature out to the live website, I want to move it to the live branch, which I then hg archive to my apache directory.
Throughout everything, I want to be absolutely sure not to push other, unrelated changes that are not yet ready to be published to the live branch.
Is this even a good idea? Or should I be doing something entirely different?
If the code is in default, how do I push only the one thing I need and not everything to live? If I push just the latest changeset, is it smart enough to send the latest version of those files, or will it only do the changesets?
If the code is in an entirely new branch, do I merge the whole branch into live? How do I get those changes back to my default branch so I see them there too?
I was reading the "Task Based Management" section of the Mercurial Kick Start guide and it mentions merging default into your branch. I found this very confusing and was wondering why you'd ever do this.
Thanks for any help you guys can provide.
[edit]
I'm using TortoiseHG BTW
[/edit]
HG now has Phases. Change a phase of a changeset to secret and it will not be pushed when you use push. You can do it using TortoiseHG GUI.
In addition to that, be aware that just pushing or pulling something does not automatically change any files in the working directory. It only makes some additional changesets available. Only by using update do you actually change any files in your working dir. (unless you configure hg to update automatically).
In the example you linked, there is a bug fix in the default branch. Bob wants to have this fix in his branch too, so he merges default branch with his branch. This is just an example to see how branching works. You do not have to use it in exactly the same way. If you just begin your Mercurial adventure, then you should better use just one branch until you have a good reason to use more.
For example: 3 developers work on the same project and all of them use just one branch (default). 1 of the developers wants to do a major refactoring of the code. He wants to commit several very unstable changesets (many "in the middle of work"). Doing so in the default branch might upset other developers. That is a good reason to create a branch. After his version is stable enough he will merge his branch into default. While he is doing development in his branch, he wants to be up-to-date with other developers, so he frequently merges default into his branch. Staying in a separate branch for too long might result in difficult merges. Luckily merging is very quick in HG, so merge often.

CCNET Trunk start building because of changes set on branch

I am using CCNET in combination with Mercurial. I have a project that got a branch and a head. they are both configured in CCNET. The branch is running fine, it only start building when there are changes on this branch.
The trunk (called default) starts building every time modifications are checked, because it "sees" the change sets of the branch. It doesnt check them out (good think), but it keeps building every time.
How can I avoid the trunk project seeing the changesets of the branch?
<sourcecontrol type="hg">
<repo>http://repository/hg/hgwebdir.cgi/projectsname/</repo>
<workingDirectory>D:\projects\projectsname</workingDirectory>
<branch>default</branch>
</sourcecontrol>
It sounds like you found a CCNET bug, but in case it's helpful later, if you want CCNET pulling down only a specific named branch you can use this notation for your repo URL:
<repo>http://repository/hg/hgwebdir.cgi/projectsname/#branchname</repo>
Which comes from hg help urls:
An optional identifier after #
indicates a particular branch, tag, or
changeset to use from the remote
repository. See also 'hg help
revisions'.revisions'.
That assumes, of course, that CCNET is using mercurial under the covers, but that's a pretty safe bet.
Doing that will cause your CCNET to only clone down and track changesets with that branch name (which still could include multiple heads).
Hmm I looks like this is a CCNET bug, I added a changeset on the default and now it stopped building every 30 seconds
this bug is currently being worked on
http://groups.google.com/group/ccnet-devel/t/fe3f768a346a3796
so any help with testing is appreciated :-)