I tried committing to a local hg repo and it refuses:
trouble committing plot.py!
note: commit message saved in .hg/last-message.txt
abort: Permission denied: /home/md/md_perf/.hg/store/data/plot.py.i
Your file permissions are messed up inside the local repository -- probably someone else pushed or committed to that repository without making sure they were leaving the permissions in a state usable by your whole group. Try these, with the appropriate substitutions, and sudo if necessary:
chgrp -R yourgroup /home/md/md_perf
chmod -R g+rwX /home/md/md_perf
find /home/md/md_perf -type d -print0 | xargs -0 chmod g+s
Related
Executing the Mercurial command:
hg in -q
produces a list like below.
123:b64543
124:ef312a
This command will be execute on multiple repo's. How can we append the repository path to the above output to identify the repo? Executing command 'hg root' gives us that information but we only want to know about the path if the repo has new changeset. We looked at template but could not find a variable that gave us the right information.
Apppreciate any help.
The easiest solution for appending the root path to hg incoming is to concatenate the two commands with && (assuming you're using Unix):
hg in -q && hg root
This works because hg incoming will return 0 if there are incoming changes, 1 otherwise (or a non-zero value if there was an error).
For more sophisticated manipulation of the output, sed can usually do it. For example, the following command prepends the root to the output:
hg in -q | sed -e "1i$(hg root)"
I'd resort to a bit bash and call hg root within the template. Assuming all directories are sub-directories of the current one (otherwise give the list of dirs differently):
for i in *; do [ -d $i/.hg ] && hg incoming -R$i --template "$(hg root -R$i) {rev}:{node|short}\n"; done
I create a local repo with
local-host $ hg init ~/test/
and then in the remote host i do a clone
remote-host $ hg clone ssh://user#local-host/test
without any issues.
When im trying to check if there are outgoing changes in the remote repo im getting this error
remote-host $ cd test
remote-host $ hg --verbose out
comparing with ssh://user#local-host/test
running ssh user#local-host 'hg -R test serve --stdio'
searching for changes
no changes found
remote: abort: no repository found in '/home/user' (.hg not found)!
remote: abort: no repository found in '/home/user' (.hg not found)!
If i commit any change in the remote/local repository and push it im getting the error but the change gets pushed.
Both hosts have the same mercurial version.
Any ideas ?
You need to let it know which repository - easiest is:
remote-host $ cd ~/test/
remote-host $ hg --verbose out
I've just gone and accidentally run hg revert *. Does Mercurial come with a tool to move all the .orig files back into place?
No. If you're in bash you can always do:
for thefile in *.orig ; do cp -v $thefile ${thefile%%.orig} ; done
This command will reinstate your .orig files from anywhere inside your repo:
find `hg root` -name *.orig -exec rename -f 's/.orig//' {} \;
You can add a hg alias for this in your .hgrc like so:
[alias]
reinstate= !find `$HG root` -name *.orig -exec rename -f 's/.orig//' {} \;
And then run it from your repo using this command:
hg reinstate
No, but your operating system probably provides cp command (or equivalent). Just copy .orig onto reverted file, or, if you've commited the file in the wanted version, revert it again from that version.
Is there any Mercurial extension that can grep for "console.log" that might have been accidentally left over as debugging code?
Right now this is what I am doing:
1) hg out ssh://....
the above is to see what is the first committed revision in my local repo, say, the smallest revision is 3456
2) hg diff -r 3455 | grep "^+" | grep "console\.log"
The number 3455 is 3456 - 1. the first grep is to see newly added code. the second one is for console.log
This method can tell that I have "console.log" in the new code, but won't say what file it is in.
It sounds like you're in need of a commit hook. Try putting something like this into your .hg/hgrc (or ~/.hgrc if you want it global):
[hooks]
pretxncommit = sh -c 'if hg log -p -r $HG_NODE | grep -q '^\+.*console\.log' ; then exit 1; else exit 0; fi'
That will abort your commits if they would be adding a line that contains console.log. Your commit message will be saved in .hg/last-message.txt.
See http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html for more details.
I'm trying to install mercurial-server. After adding my keys to keys/root and refreshing auth, I tried to clone hgadmin-repo but I get the following error:
$ hg clone ssh://hg#<domain>/hgadmin
remote: mercurial-server: no such repository hgadmin
abort: no suitable response from remote hg!
Anyone know what's the problem?
I had this same problem and for me it was a problem with the installation of the hgadmin repository. When I installed the package, I got errors from python saying the mercurial package wasn't installed. I assume that happened when mercurial-server tried to initialize the hgadmin repository. So when I went to checkout the hgadmin respistory, there was no .hg directory:
root#myshost:/var/lib/mercurial-server/repos# cd hgadmin/
root#myshost:/var/lib/mercurial-server/repos/hgadmin# ls -a
. ..
In order to resolve this, I did:
easy_install mercurial
sudo apt-get purge mercurial-server
sudo rm -rf /var/lib/mercurial-server
sudo apt-get install mercurial-server
And then continued on with the directions here:
http://kurtgrandis.com/blog/2010/03/20/gitosis-for-mercurial/
Thanks a lot Randy for exposing the exact issue here.
I struggled with the same problem, and found an alternative approach to solving it (without the need to purge and re-install).
You can initialize the hgadmin repo manually and install the hooks, achieving the same effect as a normal installation. You need to to it as 'hg' user though.
Procedure
The commands worked for my environment (Ubuntu 10.04.4 / Hg 1.4.3)
First initialise a mercurial repository in /var/lib/mercurial-server/repos/hgadmin :
$ sudo su hg
$ cd ~/repos/hgadmin/
$ hg init
Then the only difference I found with a normally initialized hgadmin repo (that I deployed in a VM for comparison) were the hooks in .hg/hgrc file. So open the file :
$ vim .hg/hgrc
and paste this exact content :
# WARNING: when these hooks run they will entirely destroy and rewrite
# ~/.ssh/authorized_keys
[extensions]
hgext.purge =
[hooks]
changegroup.aaaab_update = hg update -C default > /dev/null
changegroup.aaaac_purge = hg purge --all > /dev/null
changegroup.refreshauth = python:mercurialserver.refreshauth.hook
Are you sure your clone command syntax is correct? I see at least two errors in it:
You must put the repo you're cloning (not just the destination)
Just as for push, you must use two slashes before hgadmin:
Example FAILING (missing the source repo and using only one '/' before 'home')
$ hg clone ssh://John#127.0.0.1/home/John/delme
Example FAILING (missing the source repo)
$ hg clone . ssh://John#127.0.0.1/home/John/delme
Example SUCCEEDING:
$ hg clone . ssh://John#127.0.0.1//home/John/delme