FAQ Database Discussion Community

Mercurial undo a series of commits

I have a mercurial repo with the following history (most recent commit at the top) on a feature branch: mergeDefaultA | mergeDefaultB | C | mergeDefaultD mergeDefaultXXXX are merge commits that came as the result of merging the default branch into the feature branch. What has happened is commit C...

How do I make a revset alias for tags whose names follow a pattern?

In my repository, I have tags of the form version-1.2.3. I would like to make a revset alias new() that is called like this: hg log -r 'new(1.2.3, 1.2.4)' ...and expands to this: hg log -r '::version-1.2.4 - ::version-1.2.3' # What's new in 1.2.4? When I tried to do this:...

ignore certain mercurial commands in mercurial hook

I have a mercurial hook like so: [hooks] pretxncommit.myhook = python:path/to/file:myhook with the code looking like this: def myhook(ui, repo, **kwargs): #do some stuff but this hook runs on commands that use the commit logic to do something else, in my case hg shelve. is there a way to get...

Nginx map client certificate to REMOTE_USER for uWSGI with fallback to basic auth?

I'm using Nginx with uWSGI to serve Mercurial; it does basic auth over SSL (Nginx is the SSL terminator; it doesn't get passed on to Hg), but due to the limited security of basic auth even over SSL, as discussed at various places including this site, I want to allow...

How to view all current uncommmited changes to a specific file in hg?

How to look at all uncommited changes to a file in hg? If we use TortoiseHG it's clear, but what about command line?

How can I use a Maven project as a dependency to another Maven project?

I'm new to Maven, therefore, sorry in advance if my question is too general. I have a Maven project, call it projectA, which resides in my company's Mercurial repository (let's call it https://hg.mycompany.com/niceprojects/). Recently, I built a separate Maven project, call it projectB in the same repository. I now want...

Mercurial: How to revert a commit after amending it

I ran hg commit --amend to amend a commit, but now I want to go back to the commit before I amended it. The commit hash of the commit before the amend does not appear to show up in hg log. So how do I do this?

Automatic mercurial commit and push in build

I have a build process which includes making changes to files and committing them to source control. I am moving to use mercurial, and trying to figure out how to best do this. The problem is that the process pulls from the main repository at the start and pushes back...

TortoiseHg 3.3 “Failed to open path in terminal”

I'm using the 64-bit version of TortoiseHg 3.3 on Windows Vista64, and when I navigate to the Repository --> Terminal I get the following error: I guess that I need to change a setting somewhere, and I do not know where to look. I did navigate to C:\Windows\System32 and found...

How do I swap my master repository location in mercurial

I have a local mercurial repository. And I back it up with a clone in a separate folder that lives in my google drive folder. Every now and again I'll go into the google drive repo and do an hg pull, and google drive takes care of backing it up....

Android build fails only in TeamCity server

I am using TeamCity as my CI server.When I run a build for an android studio project it is failing. But when I open the cloned repository in Android Studio in the build server itself it gives a successful build. Please help me out.. EDIT:: When the checkout directory from...

Sourcetree with Mercurial. Undo commit that has not been pushed

I have a Mercurial repository and have made a commit but not pushed it. I want to undo the commit I looked at the help here but the menu option "Reset Master to this commit " does not appear for me. I think the command would be hg rollback. Is...

How to move code changes from one branch to another in mercurial

I have been working on a local branch and was ready to push the changes to remote branch A. Suddenly, I found out that the remote branch is closed for new changes and I will have to add the changes to a different branch B and push. Branch A has...

how to “propertly” not commit changes on mercurial?

Accidentally i hg added several binary compiled files from a project along with tons of little changes on several files. my hg status now show that i have a dozen files modified (correctly) and two dozen files added (mistake). how do i undo that? Most answers here tell me to...

Can I tell MacHG to use a specific version of Mercurial?

I would like to use a specific version of Mercurial for plugin reasons. Is there a way I can tell MacHG to use a specific Mercurial version. I know that it comes with its own, but I would like it to use 'mine', basically.

Mercurial revset selecting up to a bookmark

If I have this changesets in my repository A --> B --> C --> D * B is bookmarked and D is at the tip - how do I create a revset that will select everything between B and D but not B. Specifically I'm trying to squash C and...

Mercurial - abandoning loose ends

Due to lack of attention, I have made a rollback ("backout") that I had forgot to merge back into the default branch - which I did not notice until a bit later, causing my local history to look like this: Which seems to disallow pushing ("new remote heads"). If I...

Cut off the “desc” at N characters in hg log output with templates

I'm trying to create a custom template for hg log with a part that shows the first N (e.g. 72) characters of the first line. Based off this answer to a different question I've gotten so far: hg log --template '{desc|strip|firstline}\n' Now I'm trying to limit that bit to a...

Is there a way to set a custom base version when merging with Mercurial?

I'm confronted with a Mercurial repository that has originally been a CVS repository. It has recently been migrated to Mercurial with cvs2hg. The CVS repository had a couple of branches, lets call two of them "main" and "feature". "feature" has been branched off "main" a very long time ago. Between...

pip install mercurial error

I am on a server with no root access and I was having a lot of trouble trying to get mercurial installed because not all the python libraries were available (like osutil). I then tried: pip install mercurial It ran and did some stuff, then exited on the following error:...

Mercurial get branch name by changeset

I have tried the hg log --rev "branch([changeset])" but what I got is a collection of all the changesets in this branch. What I do want to get is the name of the target branch (e.g. default) instead of the whole collection. Is there a way to achieve this goal?...

HG clone - abort : HTTP Error 403: Forbidden/empty destination path not valid

Basically, I'm trying to serve (hg serve) my local repository and clone the same. When I gave "hg clone http://localhost:8000/" (the served URL), I got "abort: HTTP Error 403: Forbidden" When I did "unset http_proxy", tried again, abort: empty destination path is not valid popped up! Why does it happen?...

Addremove after branch merge?

I work in an environment that has a lot of development across different branches. We use mercurial as source control and often merge branches which contain other features. I am wondering if it would ever be necessary to do hg addremove after a branch merge and before committing? e.g.: hg...

Mercurial side-by-side diffs (at max term width)

I use extdiff in my ~/.hgrc... [extensions] pager = hgext.extdiff = [extdiff] # add new command that runs GNU diff(1) in 'side-by-side' mode cmd.sdiff = sh opts.sdiff = -c 'diff -dbB --left-column -y -W `tput cols` $0 $1' [pager] pager = LESS='FRX' less attend = cat, diff, sdiff, glog, log,...

How to restore deleted unversioned files in mercurial

I have just deleted all my unversioned files in mercurial thinking they were all .origs It turns out my test classes were in there which i had been working on. Is it possible to restore these in anyway? I am guessing the answer is no, I hope the answer is...

How can I repair a repository broken by hg unshelve?

I used hg shelve in a repository, where I had some unfinished changes because I needed to switch to a different head and perform unrelated changes. Once my work on the other head was committed, I switched back to the head on which I had originally used hg shelve and...

Mercurial - merging last three unpushed commits

I have (locally) three hg commits. As two of them are basically but a couple of minor corrections, I would like to merge them into a single commit prior to pushing. Any way to do that (with TortoiseHg or console)?...

Mercurial: are pre-commit hooks run for other committing commands than “hg ci”

Are mercurial's pre-commit hooks also run for other committing commands, e.g. hg backout or hg graft? Since these commands do a commit themselves, I'd like to think this is the case but I cannot find it in the documentation anywhere.

How to properly push to a repository with a newer revision number?

Please help. I'm always having a difficulty with pushing my changes to an existing remote repository where the revision number is newer. i.e. someone has pushed to that repository after I last pull. I'm using ubuntu 14.04, and netbeans and mercurial and meld and my project is a php application...

Change upstream of local (hg-git) clone from (github) original to fork

I discovered an OSS project I've contributed to had moved to github. I installed hg-git and cloned a local repo from the git:// URL; then I made changes. I then realized I really wanted my own github fork, so I made one; but I haven't been able to figure out...

How does Mercurial treat equivalent changesets?

My setup is as follows: I've a repository R with default branch and another named branch "a". On both branches, there exists a file "myFile.txt". I've cloned repository R, yielding the clones R_1 and R_2. Now I "hg up default" in R_1 and "hg up a" in R_2. In both...

Project version control organization with multiple private entities contributing

I am looking for suggestions on how to best organize this environment descried below. We are currently on Mercurial and I would prefer to stay there, however if a different version control system will help us achieve our goals, we will switch. Short summary - Our company has been contracting...

Why i can't see new branch in tortoiseHG?

I create a new branch and commit it. But my team can't see this branch in their tortoise, why?

Is there a mercurial command which can generate a clone without largefiles?

Since I believe there is no way to strip largefiles out of a repository, I'm looking for a way to either: clone to (create) a new repo that contains at least all the same files, even without history (export tip revision only) if necessary, deleting all largefiles. achieve similar results...

Android Studio: How to add a project using relative path?

I want to migrate to Android Studio instead of Eclipse to work on our Android version of our Application. I tried a lot of stuff but i cannot actually add a project reference into my Android Studio Project. Details: I have a mercurial repository consisting of theses folders: Root Root/PROJECTA...

Why won't Hg let you push with patches applied?

I can't understand why Mercurial won't let me push when patches are applied. From my point of view, applied patches affect only the current workspace and pushing isn't influenced by the state of the current workspace. In other words, I would expect that if I made some commits, then started...

Source tree commit attempt fails with cannot amend public changesets error

So that I could learn source tree, I set up a private repository in bitbucket and made 2 clones to my computer. When I try to commit from one of the clones I get the following error. hg commit -y --amend --logfile C:\Users\kirsten\AppData\Local\Temp\n1j0esve.5ce abort: cannot amend public changesets Completed with...

git equivalent to hg -R?

What is the git equivalent to hg -R? I want to operate on a repository that isn't rooted in a parent directory of the current working directory. So far I have git --git-dir="$a/.git" --work-tree="$a" diff "$a", where $a is the git repository directory....

Why these commands in mercurial create a new head?

I was asked as an assignment to figure out which of the following lines causes the number of heads to change, now I checked and saw that lines 16 and 20 add new heads to their repository, but I'm not quite sure why.. I understand that the number is changed...

Hg Mercurial - Upgrading code not in repository

I have a customized local repository of NopCommerce 3.5. The new version of NopCommerce (3.6) is out and I would like to try to update to it. I downloaded their source code and I would like to somehow replace all the files in my local repository with the new files...

How Jenkins is passing username and password credentials for checkout pull operations

I have Jenkins / Mercurial latest versions. Machine is Red Hat Linux 6.6. I'm using Release plugin in Jenkins. Maven plugins (maven-scm-plugin, maven-version-plugin and maven-enforcer-plugin) for doing release process on a project. All of these versions are using latest available versions and configuration is setup correctly. In Jenkins job, I'm...

What does it mean to “commit” changes to a “local repo”? [duplicate]

This question already has an answer here: What are the differences between “git commit” and “git push”? 7 answers I understand that "commit" is sort of like "updating" the "local repo" and "pushing" copies the local repo changes over to the remote / online repo, right? But if I...

Homebrew: PATH env var is modified before installation of Formulae (mercurial will use system python instead of homebrew python)

Trying to use Homebrew on Mac OS X 10.9 to install mercurial and make sure it's using homebrew python version. I've updated /etc/paths to list /usr/local/bin before /usr/bin. Installed python 2.7.9 using brew install python, the python executable is located at /usr/local/bin/python which is a symlink to /usr/local/Cellar/python/2.7.9/bin/python. When I...

How can I commit/push changes to a “live” branch and then keep working on my “test/dev” branch?

I'm very new to working on larger projects and using any form of version control, so please bear with me. I have a project running on a local/intranet webserver. I'm using mercurial for version control with hgworkbench/turtoisehg as a GUI. So far I've simply commited and pushed my changes to...

How to do hg revert --all with git?

When using Mercurial it is possible to issue the following command: hg revert --all --rev <revision> The content of the working directory is set to the specified <revision> but you stay where you are in the tree (same parent, branch, etc). How to do that in git? It should...

Work on one commit while browsing another (Git/Mercurial)

Say I have a huge Git/Mercurial repository with commit/changeset A and B. Now say that there are two non overlapping sets of files, say set dir1 and set dir2. Set dir1 exists in commit/changeset A, and may exist in B, and vice versa (set dir2 exists in commit/changeset B, and...

Paralell branches/clones in Mercurial?

This question is not only technical. I want to get into the concept itself, too. There is a foreign project on BitBucket (e.g. ObjectListView). And I need to work on two problems at the same time. In git I would just create to branches in my local repository after clonening....

git show-branch equivalent for Mercurial

Is there an equivalent for git show-branch --reflog="25" --list {branch-name} in Mercurial? I.e. a way of showing all commits made to a specific branch regardless of whether they have been merged or not.

When does a new head is created in a repository?

I'm assuming this is kind of weird question, but I am not sure when exactly a new head is created to a repository, for example in this question : Explain which line(s) cause the number of heads to change in any of the referenced repositories 1: /home/user> hg clone http://remoteserver/mainrepository...

Mercurial Queues: How to reorder patches efficiently

Suppose I have the follow patches in my mercurial queue: $ hg qser -v 0 A p1 1 A p2 2 A p3-StupidPatch 3 A p4 5 A p6 ... 15 A p15 Now suppose that I want to do is reorder the patches so that p3-Stupid patch is the...

avahi_entry_group_new() failed: Too many objects

I'm working on making a REST API for my research lab's database. I'm using the Django REST framework and I've gotten everything running smoothly on my local machine. All my code is in its own branch in our Mercurial repo. When I switch branches on our server, the website crashes...

Display untracked files in Mercurial commit message

When you do an hg commit, you get a list of the files that will be added. Is it possible to append a list of untracked files to the bottom of this list? I keep finding that I am forgetting to commit newly created files.

How to merge uncommitted changes in files from one local branch to another using mercurial

I am working on a local branch and made changes to a set of files : fileone.java filetwo.java filethree.java Now suddenly it was decided that changes in fileone.java and filetwo.java is a new mini-feature which should be separately pushed to remote repo. The plan is to continue development for other...

How to set up default local push path in Mercurial?

I am trying to set default local push path for Mercurial. I do not need a remote server, instead I want to use my working directory as default path. How do I set it up? My hgrc file does not work and looks like this: [path] default = /home/user/myscript/ default-push...

Mercurial difference between changesets and revisions

I'm new to Mercurial and trying to understand how things work. I wonder what is the difference between changesets and revisions ? Thanks....

How to invoke a command for each result?

I want to invoke a command for each result of the executed command. Particularly, I want to invoke hg diff <filename> for each result, returned by hg status. Is it possible to do with a single bash command? For instance, hg status returned: M project/pom.xml M project/api/pom.xml And I want...

Fixing file rename mistake with mercuial

I have a situation where I renamed a few files I was tracking in a mercurial repo without using hg rename command (just doing it via the file system). This occured several revisions ago Now I want to return to a revision prior to the file renames, fix a bug,...

How do i update my code base in git without having to delete, stash or checkin my current changes?

My team just moved our project from mercurial to git and I'm still getting used to the workflow. When we used mercurial my flow would look like this: write some code hg pull hg update resolve any merge conflicts continue writting code, repeating the above steps until finished hg pull...

Can mercurial pull changes from forked repo into a new branch?

I have a project, biocommons/hgvs. A contributor forked the project, made some changes, and submitted a pull request. I'd like to make some minor changes to those commits, and I'd prefer to do so in a feature branch. Is there a way to pull the PR commits into a new...

Remove a revision in TortoiseHG

I know this question has been asked and I know it´s against version control. But we have done some minor changes in the layout etc. and would like to remove the history of 30 revisions. Is it possible to just remove these 30 revisions or merge them into one revision?...

Phantom Mercurial, How to remove?

I'm trying to install TortoiseHg on Ubuntu 14.04. It went fine, but trying to open it complains about having an unsuported Mercurial version (3.4.1). I removed via: sudo apt-get remove mercurial sudo apt-get purge mercurial sudo dpkg -r mercurial sudo dpkg --purge mercurial It comes out as successful, but if...

Searching for the change history of partial file or path in Mercurial or TortoiseHg

Each time I need anything beyond the standard search, I find myself trying several things, searching Google and in the end terribly failing. Apparently, the Hg search syntax is pretty extensive and I would like to use its power, but I don't seem to be able to find a good...

Mercurial - clone all remote branches at once

Wondering if Mercurial while cloning the repo includes all remote branches as well? Basically I have some proprietary / not used mercurial repository with many branches. I want to clone all of them at once and make backup out of it.

Git plugin for Android Studio without any additional external programs

With Eclipse I was able to install just a simple plugin, that allowed me to use BitBucket with it. Everything I needed was inside Eclipse. Is there such a plugin for Android Studio too? I still want to use BitBucket for my projects, and I don't want to install any...