Unable to push to a Bitbucket Mercurial Repository - mercurial

I am using SourceTree with Bitbucket.
I used to be able to push without errors.
Now I get
hg push --new-branch default
pushing to https://bitbucket.org/myusername/myrepository/branch/default
abort: HTTP Error 404: Not Found
Completed with errors, see above.
I can see the repository in the browser.
I can push from a different machine. It works correctly on a machine where the url is myusername#bitbucket.org/myusername/myrepository.

You have to drop the branch/default part of the URL. The canonical repository URL is https://bitbucket.org/myusername/myrepository/.
For some reason, bitbucket allows read operations from URL/more/stuff but not write operations.

Related

Mercurial/TortoiseHg responds with "abort: destination does not support push"

I want to push a repository from my computer to a repository on a remote site for the purpose of synchronizing the files. TortoiseHg seems to correctly identify outgoing changesets, but when I try to push the changes, TortoiseHg responds with "abort: destination does not support push" with "Push to https://myid:ps#mydomain.com aborted, ret 255" in the status bar at the bottom. The log file includes "(falling back to static-http)"
I've googled but I'm getting nowhere. What does "abort: destination does not support push" mean in English? What doesn't support push? What is the "destination"? Is it the settings in the config files in the repo that make it so the destination doesn't support push? Is it the way the server is set up?
One of the responses to 27967022 "Your destination does not support push, or push is disabled" So how does one enable push?
If you use hgweb on the server side, to allow pushing to a repository, add
[web]
allow_push = *
to its .hg/hgrc on the server or in your hgweb.config. You can also allow pushing only for specific users by listing them instead of *. This is documented here.
If that is not the case and you just use the https server to serve the repo as files, you'll not be able to push via https. In that case, your most likely option is to push via ssh, as in
hg push ssh://myid#mydomain.com/path/to/repo
This requires that you have ssh access to the server and that the repository lies in $HOME/path/to/repo. For an absolute path (if the repository lies in /path/to/repo and not below $HOME), push to ssh://myid#mydomain.com//path/to/repo (note the double slash).
If you always push to the same destination, you can add this path to your local .hg/hgrc:
[paths]
default-push = ssh://myid#mydomain.com/path/to/repo
so that you can then just use hg push.
What are you running for your mercurial server on mydomain.com? If it's hgweb, then #wintermute has your answer. If you're serving static HTTP (using Apache, nginx, etc.) then your server is setup for clone or pull, but not push. More likely you just need to enable push like #wintermute is saying.

Clone mercurial repository to external repository

I have a mercurial server, running RhodeCode, that I commit my code to. My client has a Redmine installation and has requested that code I modify for them be stored on their server (understandable).
I would like to still commit to RhodeCode and after a successful commit, push these changes to their repository automatically. They have their code in both an SVN repository and a mercurial repository. I am allowed to commit to either - and they handle the synchronization between the two. My assumption is that it'd be easier to push to a mercurial repository.
I have a changegroup hook in mind, but I have a few technical questions on how this should work.
What is the best way to handle both receiving and pushing out to an external repository though?
User ----> RhodeCode ----> Redmine
At the RhodeCode step/changegroup hook, how do I forward on my changes? Can I do it directly from the main repository or am I forced to clone it into another directory and push that to the client?
Is there a better way to maintain my master repository and push my client's changes on?
I see no problem with this; the Mercurial hook in Buildbot works this way, doesn't it?

hg - what to do when hg push times out

UPDATE - I'm probably being daft, see my last update below.
I just did a hg push and it timed out, and now when I try hg push again I get a message 'no changes found', however I can see in the target repo that all but a few of the changes didn't make it to the repo. How can I push my changes to that repo?
The history behind this is I'm migrating from SVN to Mercurial (bitbucket). I've done the following:
Used svnsync to get a local copy of the SVN repository.
Created a new repo within bitbucket
Cloned the repo to my local machine
Done svnadmin convert from my local SVN repo to my local Hg repo
Run hg push to push the changes to bitbucket
The last command prompts me for HTTP authorisation, then says 'searching for changes', no output for >15 mins, then output 'abort: HTTP Error 504: Gateway Time-out'. Full process was:
C:\dev\sandbox\svn_to_hg\dev_hg>hg push
http authorization required
realm: Bitbucket.org HTTP
user: my_login
password:
pushing to https://bitbucket.org/my_login/dev
searching for changes
abort: HTTP Error 504: Gateway Time-out
C:\dev\sandbox\svn_to_hg\dev_hg>hg push
http authorization required
realm: Bitbucket.org HTTP
user: my_login
password:
pushing to https://bitbucket.org/my_login/dev
searching for changes
no changes found
It seems that because there are so many changes it's taking too long between HTTP auth and when it actually pushes the changes, or something like that, and probably if I set up SSH keys it'd not need to cache the HTTP authentication so it wouldn't time out. Any ideas if that's correct? Regardless, I still need to know how to push these changes that hg now thinks have already been pushed.
In my bitbucket repository there are about 20 changesets from SVN from a few years ago, but there should be several thousand.
UPDATE:
hg out gives me this:
C:\dev\sandbox\svn_to_hg\dev_hg>hg out
http authorization required
realm: Bitbucket.org HTTP
user: my_login
password:
comparing with https://bitbucket.org/my_login/dev
searching for changes
no changes found
Looking at the repo using TortoiseHg repo browser shows there is tons of stuff there.
UPDATE:
Perhaps I'm being daft, now when I look at the repo within bitbucket it does seem that there are lots of changesets. But what timed out? Should I worry that all my changesets didn't make it to the server?
It seems that all changesets did make it - i.e. answer is to retry and then trust Mercurial.

Unbundle throws " abort: error: ftp error: no host given" when using a local network share with an UNC path

Before explaining my problem let me tell you the Mercurial setup,
We have the following repos,
RELEASE
DEVELOPMENT
BUGFIX
All the above repo are running on a central server using IIS and hgwebdir.cgi
Now coming to the problem,
I clone a local repo from DEVELOPMENT repo.
I make changes to the clone and commit (Not push).
I make a bundle from the clone and pass the bundle to QA who has cloned the RELEASE repo.
Now I try to apply the bundle to the RELEASE repo clone using hg unbundle
I get an error, abort: error: ftp error: no host given
What am I doing wrong? Can you give solution to the above problem keeping a Windows setup in mind?
It really sounds like you have a syntax error in your unbundle command. The normal usage is just:
hg unbundle c:\path\to\the.bundle
there's no ftp involved unless you're trying to use a ftp:// URL which isn't supported. Is it possible you have a directory named ftp and the parser is mistakign it for a component in a ftp URL?
Also, most folks wouldn't use bundles in the scenario you're describing. They'd just do:
hg push URL-or-file-path-to-QA
and push direct to QA's own repo (not to RELEASE)
People generally use bundles only when a network connection isn't possible or practical.
I experienced the same problem, I don't think hg likes uncs.
I mapped \server\DevSourceCode\Mercurial to R: and it worked fine, see below:
R:\Repositories\myproj>hg unbundle \\server\DevSourceCode\Mercurial\ChangeBundles\myproj_changes.hg
abort: error: ftp error: no host given
R:\Repositories\myproj>hg unbundle R:\ChangeBundles\myproj_changes.hg
adding changesets
adding manifests
adding file changes
added 0 changesets with 0 changes to 139 files
(run 'hg update' to get a working copy)

How do I push a new project to a shared Mercurial multi-repository?

I have a local machine ("laptop") and a shared Mercurial repository on another machine ("server").
The shared repository is set up as a multi-repository as described in the Mercurial documentation using Apache, the hgwebdir.cgi script and Mercurial 1.4.
The setup works in the sense that I can browse the projects (repositories) in the web browser, I can clone and pull from the server, and I can push from the laptop when the project/repository already exists on the server.
But I cannot create a new project on the laptop (hg init, do stuff, hg commit) and push it to the shared multi-repository (hg push http://server/hg/my-new-project-name) - I get "abort: HTTP Error 404: Not Found", presumably because the directory/project repository does not exist yet.
How can I push a new project/directory structure to a Mercurial running elsewhere? I couldn't find anything in the documentation, how do you guys do it?
You cannot create new remote repositories over http with the built-in functionality. Your options are to either:
create with a ssh clone: `ssh clone local-repo ssh://you#remote//path/to/repo'
log in to the remote repo and do a hg init where you want the repo. After that you can push to the new empty repo
Use a cheesy http-creation CGI like the one I wrote here: http://ry4an.org/unblog/UnBlog/2009-09-17
Update
I tried using Dropbox as described below, but couldn't make it sufficiently reliable, so I'm not recommending that option.
Original answer below, kept for context.
/update
I found one more option: Skipping both http and ssh altogether and using Dropbox for shared repos.
For the one-person-multiple-computers scenario, it looks like the simplest option of the lot, and you get backups as a nice side effect.
Here is a discussion on Hacker News