hg pull do not retreive changes - mercurial

I've been using hg for a few years with a BitBucket Repo. I use it to archive my development but also to synchronise between different computers (mainly my desktop and my main laptop). So far, no troubles.
But today, when I did an hg pull to get the latest version from the server, I got the response "no changes found", when I can see the changes made yesterday on the server, and still no replicated on my files, locally.
I eventually got the latest version using hg graft -r the_latest_version, which solve my problem for now ... however this was easy to see as it was for a shell script with only a few files.
With projects with plenty of files, I might not spot the problem early enough. Any ideas on what went wrong and how to correct it ?
Cheers.

OK, the answer is: I just forgot I needed to perform hg update after hg pull !
Thanks to #planetmaker for pointing in the right direction !
Sorry for the disturbance!

Related

How do I restore a committed file through GitHub?

Unfortunately, my computer crashed and I lost some lines of code that I typed. I committed my changes through Git before it crashed, so my repository has all of the code I lost. (I'm not sure how I didn't save before committing, but definitely something to look out for in the future...) My question is: How do I go about restoring my old file from Github to my Desktop through Git?
I hope I understood correctly, all you need to do is simply run 'git pull' on your terminal (if you are in the root directory of the project) and that's it. Hope it helps :)
You should check the logs using git log.
Finding the commit you need and the using a git reset.
Here is some documentation if you need it: https://www.git-scm.com/docs/git-reset

BFG-repo-cleaner and pushing back to GitHub

I'm trying to follow the tutorial instructions here : https://rtyley.github.io/bfg-repo-cleaner/
I clone a new copy of my github based repo with --mirror
I follow the instructions for running bgf and reflog
My local repository has now removed the big blog. Great.
When I go to push back to github I get
To github.com:interstar/myproject.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'git#github.com:interstar/myproject.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
So I try to git pull from github to ensure sync. (Even though this repository was cloned cleanly from github at the start of the process)
And it pulls down all the blobs I want to get rid of. So my repo is back up to its previous size.
So I run bfg and reflog again. Nice small repo.
Try to push back to github
Same error message.
What am I missing?
OK.
I solved this. It was my own stupid fault, but leaving the question in case anyone else does the same thing.
Although the first time I cloned the repo from github I used --mirror, at some point I tried again and forgot to use the --mirror option.
When I started over with that option it worked as the tutorial suggested.

Mercurial and TortoiseHg: How to push a fresh copy without pulling

So here's the sitch:
I am working on a Unity game project with a few others. We are using Tortoise with a repo hosted on BitBucket. One of the other people pushed a version with a huge amount of unnecessary files that we had previously deleted. I'd like to revert his push if possible. Ideally, without having to pull what he has pushed because I don't want to spend 20 mins downloading all of these extra files just to get rid of them again.
Is there any way to do this? Is it possible to push my current commit as a fresh copy to the repository?
Thanks in advance for any help
Actually, if the files were previously in your project and then deleted, they will be in your local copy of the repo already. The repo includes all the history for your project. You could see them if you did an "hg update" to a past version which included those files.
That said, to revert the change use BitBucket's web interface:
How do I delete/remove a push from Bitbucket?

hg largefile XXX missing from store (needs to be uploaded)

A coworker got this error after pulling from the repo. I searched for an answer online on how to solve it but couldn't find anything. I figured out a way to solve it so posting it below for anyone else with the same issue.
I asked everyone else working on the repository to check their user cache folder (C:\Users\username\AppData\Local\largefiles on Windows) to see if they had a file with that id ("XXX" from the title).
One of them did, the original author of the file.
I asked him to send it to me, I remote connected to the server that has the central repo. I then copied the file both to the server's cache and into .hg\largefiles
The user could then pull again and push and everything worked.
LF extension seems not compatible with keyword extension.
With these both extensions, at the commit, the LF is NOT put in the configured folder on the PC and then raises this error at push.
If you disable the keyword extension, it's perfectly working.
Unfortunately, I've not found any additional explanations.
If someone could provide a stable solution, it will be great.
It looks like hg pull is happily sparse, but hg push is not; thus you need all largefiles for every revision not already present on the new remote, so that it can populate for history and allow clients to successfully pull at any revision. Which makes sense.
When migrating to a new hg server, I hit this issue. The "within Mercurial" solution was to download all largefiles, for all commits, to my local repo, and then push to the new server repo:
$ hg lfpull --rev 1-tip
$ hg push newbox
(Disclaimer: my Mercurial-fu is weak, I only use it for this one largefile repo)

Is it possible to checkout a single directory from a Mercurial (HG) repository?

So, I'm trying to checkout just the TestNG plugin from the Netbeans contrib repository. (Or is it module? I'm new to Mercurial, so I don't really know the lingo yet.)
When I run the following command...
hg clone http://hg.netbeans.org/main/contrib/
...I get the entire repository, which contains all of the the contrib plug-ins. Is it possible to just pull this location?
http://hg.netbeans.org/main/contrib/file/tip/testng/
Thanks!
This concept is called "narrow cloning" and no, it's not possible at the moment in Mercurial.
It's on the radar of some of us that contribute to Mercurial but it's a hard problem to solve. For example:
How do you calculate the hash of any new commits you make if you don't have all of the files in the repo?
What happens if you try to view the history of a file in contrib/testng if that file was moved from another folder?
I'm not sure, but I think the answer in the general case is "probably not".
If the repository is local (it doesn't sound like it is in your case), you can do something like:
hg archive -R /path/to/my/repo -I /path/to/my/repo/folder/i/want export-folder-name
(The command would need to be something that exports non-VC'd files, rather than creating a partial repo, since the .hg stuff is stored once at the toplevel, rather than in pieces in each folder as SVN does.)
It doesn't work on remote repositories, though. Neither does "hg log", and the hg folks explained why:
Imagine I send a log -p command to http://www.kernel.org/hg/linux-2.6, which is
approaching 100k changesets. At one diff per second (lots of seeking), this will
take about 3 hours of CPU/disk time on the server, nevermind metric tons of
bandwidth. It would be faster and simpler for everyone just to clone the repo
and do the log locally.
I suspect hg archive can't work remotely for the same reason.