I'm trying to do a hg clone on an Internet facing machine for later use on an offline build machine. Unfortunately mercurial is 3.9.1 on the Internet machine, but 1.4 on the offline machine.
I get the error abort: requirement 'generaldelta' not supported! and also abort: requirement 'dotencode' not supported!
I found this is becuase generaldelta feature was added in 1.9, and dotencode in 1.7. I've used instructions from the MissingRequirement wiki page to downgrade this repo using the following.
hg clone -U --config format.generaldelta=0 --config format.dotencode=0 --pull /tmp/foo /tmp/bar
However the new repo at /tmp/bar still uses generaldelta, although dotencode require has gone. i.e.
cat /tmp/bar/.hg/requires
fncache
generaldelta <=== still there
revlogv1
store
store
How can I rewrite the repo with both generaldelta and dotencode disabled?
The config option should have been format.usegeneraldelta not format.generaldelta. i.e.
hg clone -U --config format.usegeneraldelta=0 --config format.dotencode=0 --pull /tmp/foo /tmp/bar
Note the config. options are all config.use<feature-name> apart from config.dotencode see Mercurial format options. Beware as there is not any error checking either.
Related
Is there a way for running mercurial without any external extension using a command line switch / environment variable?
For example, in this situation:
$ hg version --debug
Mercurial Distributed SCM (version 4.3.3)
[...]
Enabled extensions:
hggit external
hgremotebranches external
mq internal
rebase internal
shelve internal
How can I accomplish:
$ hg --disable-all-extensions version --debug
Mercurial Distributed SCM (version 4.3.3)
[...]
Enabled extensions:
<empty>
I know I can disable individual extensions via --config extensions.name=!, but I need to nuke everything at once.
From hg help environment:
HGRCPATH
A list of files or directories to search for configuration files. Item
separator is ":" on Unix, ";" on Windows. If HGRCPATH is not set,
platform default search path is used. If empty, only the .hg/hgrc from
the current repository is read.
So you can do:
HGRCPATH= hg version --debug
The mercurial developers encourage everyone to use this incantation in scripts to avoid having the meaning of mercurial commands depend on a user's configuration. See http://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/automation.html for more information from Mozilla about automating mercurial.
Is there a way to get logs for a mercurial repo like so:
hg log -v "http://some/remote/repository"
instead of
hg log -v "C:\Users\Repo"
Mercurial does not support that operation. You firstly have to clone the repository.
See more here
If you have an http-served mercurial repository (which you seem to) you can get the log by going to http://some/remote/repository in your web browser. You can also start a web server on any repo by issuing the hg serve command. By default, this will start a web server on port 8000 and you can view it by going to http://repothost:8000/ or, if local, http://localhost:8000/.
I'm having some difficulty cloning my mercurial repository over ssh.
Here's what I have tried:
hg clone ssh://username#username.webfactional.com/path/to/projectname projectname
It's giving me this error:
remote: bash: hg: command not found
abort: no suitable response from remote hg!
hg is installed on the server, however.
I was trying to follow the instructions on this website.
You need a double // after hostname i.e.:
hg clone ssh://username#username.webfactional.com//path/to/projectname projectname
Sounds like hg is not on your path. The Mercurial FAQ mentions possible fixes for this issue: FAQ/CommonProblems.
Add the remotecmd value to your Mercurial configuration by opening ~/.hgrc (or Mercurial.ini on Windows) on your client machine and adding the following:
[ui]
remotecmd = /path/to/hg
where /path/to/hg is the path to the hg command on the remote server.
If you're having problems with your Mercurial configuration, you can use the hg showconfig --debug command to obtain a full list of your Mercurial settings along with the path and line number of the configuration file that defines each configuration value.
Looks like mercurial isn't in your user's PATH on the remote server.
On webfactional I had to add:
export PATH=$PATH:/home/<user>/bin
to .bashrc to get it to work.
(also followed the remotecmd advice above)
You can use Sourcetree, TortoiseHg, Mercurial from the terminal, or any client you like to clone your Mercurial repository. These instructions show you how to clone your repository using Mercurial from the terminal.
From the repository, click + in the global sidebar and select Clone
this repository under Get to work.
Copy the clone command (either the SSH format or the HTTPS).
If you are using the SSH protocol, ensure your public key is in Bitbucket and loaded on the local system to which you are cloning.
From a terminal window, change to the local directory where you want to clone your repository.
Paste the command you copied from Bitbucket, for example:
CLONE OVER HTTPS:
$ hg clone https://username#bitbucket.org/teamsinspace/hg-documentation-tests
CLONE OVER SSH:
$ hg clone ssh://hg#bitbucket.org/teamsinspace/hg-documentation-tests
If the clone was successful, a new sub-directory appears on your local drive.
This directory has the same name as the Bitbucket repository that you cloned.
The clone contains the files and metadata that Mercurial requires to maintain the changes you make to the source files.
On the server, type: nano ~/.bashrc end edit the file by adding:
# User specific aliases and functions
export PATH=$PATH:$HOME/packages/mercurial
Under the assumption that ~/packages is the folder where mercurial was installed.
After editing, finish off with source ~/.bashrc and try again.
Pretty helpful to me was the following elaborate guide to install mercurial on a Bluehost hosting server.
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)
I am working on a system that performs continuous integration and I am looking for a method I can use to get the most recent changeset from a Mercurial repository without creating a repository locally.
I have considered using clone but this method will only work if you have set a working directory locally (since this will be occurring on a build server, I would prefer not to do this because of inclusion of the .hg file and the diffs - all I want is essentially an export of the files from the tip revision and nothing more.)
This request may not even be possible, and it's very likely that I just do not understand DVCS very well. However, if I cannot do what I want to do, is there a workaround?
It's possible using 'hg archive' depending how your remote repository is set up.
If it's available over HTTP using hgweb.cgi or hg serve you can hit the archive link programmatically to get the files you want. Example:
wget https://www.mercurial-scm.org/repo/hg/archive/tip.zip --output-document=- | unzip -
or it's available over ssh:
ssh you#there.com hg archive --type=zip - | unzip -
You can use:
$ hg clone http://your_repo
$ hg archive ../export/
$ rm -rf *
$ cd ..
$ cd export
From Mercurial's help files:
$ hg help archive
hg archive [OPTION]... DEST
create an unversioned archive of a
repository revision
You can use:
http://merc/raw-file
to retrieve a list of files in the repository or
http://merc/raw-file/filename
to get a specific file.