pull/update from wrong repo
Becker, Mischa J
mischa.becker at fredmeyer.com
Sat Oct 12 01:51:12 UTC 2013
> From: Ross Boylan [ross at biostat.ucsf.edu]
> Sent: Friday, October 11, 2013 4:24 PM
> To: mercurial at selenic.com
> Subject: pull/update from wrong repo
>
> I pulled from the wrong repository (a separate project, though a few of
> the files are common) into the local "Ross" project and then did an
> update. I noticed lots of messages "removing filexxx" and interrupted
> it; I do not recall exactly how. The I tried to roll back.
>
> Current state of "Ross"
> 1) history shows no sign of the bogus changes I pulled in
> 2) The files mentioned in the "removing" messages seem to be gone from
> the working directory; hg status shows them as missing ("!"). I assume
> this means I can recover them.
> 3) There are many files in the working directory not under version
> control (hg status shows "?"). There were many such files before the
> bogus merge as well.
> 4) I don't know if any files that weren't under version control were
> deleted.
> 5) Plenty of files that were under version control are still in the
> working directory.
>
> The manual for hg update says
> "If the changeset is not a descendant or ancestor of the working
> directory's parent, the update is aborted."
> That was not what happened.
I don't think that applies when you supply a revision to update to. Also, your update used --check. The rest of that paragraph in the manual says:
"With the -c/--check option, the working directory is checked for uncommitted changes; if none are found, the working directory is updated to the specified changeset."
> I am trying to understand what happened and the best way to recover.
> I was using tortoisehg 2.8.1 on windows, with Hg 2.6.2.
>
> "Ross" is the big project. "Sunbelt" is a smaller project. Over
> Sunbelt's life some files were copied from "Ross" via the working
> directory and added to the project. I'm pretty sure I did not merge any
> changesets from Ross into Sunbelt. I copied some of the files back to
> "Ross", again via the working directory.
>
> Questions:
> 1) Would the operations have deleted files that were not under version control?
90% of the time the answer is no, files not under version control are left alone. However, if the file *was* under version control at some point in the past, it is possible for it to get deleted. I've had it happen to me once or twice but I no longer recall the specifics.
> 2) What's the best way to recover? Is there an easy way to bulk restore the versioned files that were deleted?
Assuming you didn't have any uncomitted changes before the bad pull, the simplest way to recover is
hg up --clean
> 3) What happened?
While you have never merged between projects, the repositories themselves are related. I bet if you look at the initial commits in both projects, you will see that they are the same. If there was no common ancestor between the repositories the pull should have failed since you didn't use --force.
Secondly, instead of just using hg up to update to the tip of the current branch, you did hg up --rev 1183 --check.
>
> Thanks.
> Ross Boylan
>
> Here's what the log window showed, ### before comments added later:
>
> % hg --repository I:\LAMOC\Ross pull --verbose
> c:\users\rdboylan\appdata\local\temp\thg.mrahtg\https__bitbucket.org_RossBoylan_sunbelt_eatky7.hg pulling from
> c:\users\rdboylan\appdata\local\temp\thg.mrahtg\https__bitbucket.org_RossBoylan_sunbelt_eatky7.hg
> searching for changes
> all local heads known remotely
> 43 changesets found
> adding changesets
> adding manifests
> adding file changes
> added 43 changesets with 44 changes to 9 files (+1 heads)
> (run 'hg heads .' to see heads, 'hg merge' to merge)
> [command completed successfully Fri Sep 20 16:34:12 2013]
> % hg update --verbose --config ui.merge=internal:fail --rev 1183 --check
> resolving manifests
> removing 090729 LAMOC sexual behaviors.doc
> ### many more removing ... messages
> removing drugs02.log
> ### note: no message about abort or complete
> % hg update --verbose --config ui.merge=internal:fail --rev "Real Corr" --check
> abort: uncommitted local changes
> [command returned code 255 Fri Sep 20 16:39:45 2013]
> % hg rollback --verbose
> repository tip rolled back to revision 1140 (undo pull:
> bundle:I:\LAMOC\Ross+c:\users\rdboylan\appdata\local\temp\thg.mrahtg\https__bitbucket.org_RossBoylan_sunbelt_eatky7.hg)
> [command completed successfully Fri Sep 20 16:40:18 2013]
> % hg --repository C:\Users\rdboylan\Documents\Sunbelt incoming --quiet --bundle
> c:\users\rdboylan\appdata\local\temp\thg.mrahtg\https__bitbucket.org_RossBoylan_sunbelt_8lifzl.hg
> https://bitbucket.org/RossBoylan/sunbelt
> ### long list ....
> [command completed successfully Fri Sep 20 16:41:58 2013]
________________________________
This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
More information about the Mercurial
mailing list