TortoiseHg shelve-update-unshelve shortcut - mercurial

Using TortoiseHg Workbench, almost every time I pull from a remote repository, I have uncommitted code changes so that I need to shelve them before I update and then unshelve them again.
Is there a way to do this all in one click? I seem to remember being able to do this when I used Git (perhaps with GitHub for Windows).

Follow-up or comments
Tried to add button to THG GUI
Defined new tool in Tools menu
Added to toolbar (failed, no buttom on toolbar, I suppose, due to icon size /small/ - using path to big icon file instead of embedded may change visibility result)
Tried to add to Revision Context Menu and use added feature
As you can see - button added, but command failed (for unknown reason): using plain hg for PATH\hg.exe is recommendation from "Define tool" window from THG

Related

GitHub Website Publishing of "Knit"-Generated HTML files in RStudio

I want to share a step-by-step illustration on how to publish online your work on RStudio using GitHub pages.
A lot of people taking the Coursera courses on data have problems with it if they don't come from computer science, including myself, so I want to share a system that works. I'm sure it can be greatly improved.
Let's do it step-by-step, really easy:
1. Start with Github, not with RStudio.
Don't have an account, sign-up for one - it's free and incredibly valuable. Now go to Repositories (top menu bar), and press on the green button New in the upper-right-hand corner. Give a name to the repository ("test" for our puposes). You can skip the Description if you are in a hurry to proving to yourself that it works (same for the prompt to write some memo style one-liner under README). So go... click on Create Repository (green button). Now don't panic... just go directly to Settings (the cogwheel symbol in the vertical menu on the right-hand side). Perfect! One more click and we're there... Launch automatic page generator. Now we enter the guided part. Feel free to leave all this as is for now... We can modify it later, or we can go back and do it all over again when we know the end of the story (with a real repository that we do intend to publish. Click on Continue to layouts. Click on any of the designs (I chose "Architect)... And Publish page (green button upper-right corner). Beautiful!
Quick check: Click on Settings again, and check under GitHub Pages for the message: "Your site is published at http://...github.io/test. In my case the address is http://rinterested.github.io/test/ (was... I erased it after I finished this post) beacuse my Github account is RInterested. Very critical: pay attention to the structure: github.io without this there's no website. Now you can go to your browser, type the address and see that a new site has been born (caution: sometimes this takes minutes to materialize).
2. Now it's time to go to RStudio. If you're taking the Coursera course this is your comfort zone. If not I will assume that you've been working with [R], and that a simple download of RStudio (free online) is about to change your life for the better.
So we start RStudio and we go to the upper-right corner, where there is a cube containing an R, and the word Project. See it? Great, because we are going to start a New Project from the pull-down menu. Pop-up... which one to choose? Version Control is the answer. More pop-ups... No panicking... Click on the gray/red/green sideways GIT symbol ("Git Clone a project from a Git repository"). We have that, remember? We called it "Test". And we are facing a final screen with three fields to fill in. Under Repository URL we need to enter information that will require a quick trip back to Github for a second...
Are you there? OK... Do you see the HTTPS clone URL thing with a clipboard symbol on the right, half-way down within the test repository? Click on the clipboard symbol... Copied! Great! Now we go back to the screen with questions on RStudio, where we got re-routed, and do a right-click and paste, filling in the Repository URL field of the questionnaire. The rest is not critical. Press on Create Project... That's it!
3. Time to work. Let's now create a new R Markdown document by clicking on the corresponding option on the pull-down menu in the left-upper corner (green plus sign on a sheet of paper icon). Give it a name. You are the author. Select HTML. Click OK. Now you can modify, add, or just leave what popped-up on the screen as is to finish up the demonstration. Notice that there are so-called chunks of code started with ``{r} which indicate that the following code will be executed upon rendering the html document (or pdf). echo=FALSE means that only the result of the code (not the actual command) will be printed.
OK. Press on the top menu where you see a knitting pin (Knit HTML)... give it a name and save the document... Very important... whatever you name it it has to end up in .Rmd (case sensitive). What about "cars.Rmd"? Original enough... Save it and watch RStudio do its magic... Hopefully you're now admiring a beautiful webpage with a plot and numbers... Only one problem... It is NOT online.
4. Pushing our work to GitHub:
We are going now in the opposite direction. First, click on the GiT super-cool symbol on the top menu (above "knit HTML" depending on the configuration of your RStudio). It's a pull-down menu. Select Commit. You can select cars.html, or everything. Disregard a warning message, and post an ultra-short note under "Commit message". Whatever you want to write (e.g. "update"?). Click on the Commit button - very important! Now you are ready to click on Push... You guessed it... It's the green button. You will be prompted to enter your Github account Username and Password. Do so.
5. Back to GitHub:
Refresh the page displaying our "test" repository. You should now see the additional documents, including cars.html
Quick check: Go to your browser and enter in the URL bar what for me would be rinterested.github.io/test/cars.html (remember that you can get your own website address by going under Settings as explained above), and then just tag on the name of the document we have worked on with RStudio.
6. Hyperlink the pages:
As a test click on "index.html" under the "test" repository and somewhere there, in the body embed the following:
Click here to go to cars.
You will have to click on the pencil icon to edit this file. When done click on Commit changes. Go back on the browser to see your site. Refresh until it's updated with the hyperlink you just embedded. Click on it... You are now watching your RStudio work fully functional online. Magic!
Now it's just a matter to change things around using some html code quickly accessible online, changing the wording on the index.html (home page), or perhaps building a nice site with internal cohesiveness from scratch.
Good luck!
An alternative (more manual) approach - anything covered on the initial answer skipped.
1. Create a Repository in GitHub
Let's call it Course_project without need to README - we're just going to need its URL.
2. Open Windows PowerShell (or Git Bash)
Opening Git Bash is as simple as to right click on the directory in Windows Explorer we want to select, and click on Git Bash here. I'll use PowerShell. You can get the directory you're in by typing pwd. From there we can type ls to list subfolders, all along changing directory to reach where we want to be - for instance cd R to get R as the working directory.
Clone project by typing https://github.com/RInterested/Course_project.git (I am RInterested, so change that part to your GitHub username; also remember that "Course_project" is the name of this project). Change the directory to Course_project by typing cd Course_project. We now create a branch without parent branches: git checkout --orphan gh-pages. Make sure that the cloned Course_project is empty by typing: git rm -rf . We'll soon work with real RStudio markdown, but just to test what we have done so far, we can type into the empty working directory a name of a webpage: echo "Test Page" > index.html. Time now to Add/Commit/Push: git add index.html followed by git git commit -a -m "first commit", and git push origin gh-pages. This page is now visible at: http://RInterested.github.io/Course_project/index.html.
3. Creating content with RStudio
We have a directory (Course_project) and a toy index.html in it... We need real content. So we go to RStudio. Create an R Markdown file and name it (I'm calling it mtcars). Check HTML as the output. Change the document (some info about it in the answer above). Finally, an important step: Save it as Index.Rmd(make sure that the R working directory is the same as in PowerShell). Click on knit HTML to create the html file rendering the R code embedded in R Markdown.
4. Pushing it upstream with PowerShell
Now we have material within the directory Course_project, but it is not online - it is still local (you can go to it with Windows Explorer and see the html file under "index"). Type git status to see the changes made, and again follow the routine Add/Commit/Push: git add ., followed by git commit -a -m "commit", and git push origin gh-pages.
After a while the page will be live in http://RInterested.github.io/Course_project/index.html
5. Adding a second page
We can now start a second R Markdown file on RStudio (I labeled it Second_page and saved it as Second_page.Rmd. After writing what we want we knit HTML, and we can see these two new files appear in the Course_project local folder. We simply have to Add/Commit/Push like before in PowerShell. The new page will be in http://rinterested.github.io/Course_project/Second_page.html. It is very easy now to type a hyperlink on the first (index.Rmd) to the second (Second_page.html), knit the index.Rmd, and push it up to the web.

MercurialEclipse icons after pull

I'm new to Mercurial and MercurialEclipse, and I think I'm not quite understanding this:
After I pull from the central repository (with Update After Pull selected), it is my understanding that all files are loaded form the central repo to my local repo. However, after I pull, I'm seeing the following:
Doesn't the star icon indicate that there are differences between my local copy and the central copy?
What am I missing here? How do I make sure that my files are the most recent copies?
Try right-clicking on your Eclipse project and select Team --> Refresh Status. I often have to do that for the status icons to be updated.
Edit: if you want to override all local changes, select the checkbox "Clean update (override local changes)" in the Pull dialog of Eclipse.
When you update it merges the local changes you have with the changes in the revision you are updating to. In the update dialog if you select the "force" checkbox it will revert any uncommitted changes. Other ways to remove your local changes are updating by right clicking on a revision in the history view and selecting "switch to", or use the "revert" dialog.

What to do after a force push to Mercurial?

I made the mistake about 3 months ago of doing a force push to Mercurial, and somehow, it has remembered that...so whenever I push now, it forces it by default:
% hg --repository C:\Projects\Sonic\DDSF push --force ssh://192.168.52.2:22//hg/DDSF
How do I get rid of this setting and go back to the regular pushes?
My team gets mad at me daily because I'm constantly creating new heads and breaking stuff :(
I've checked my .hgrc file and its not there. I've also re-installed the TortoiseHg client in hopes that it would solve this problem but it hasn't.
In TortoiseHG, you can disable the setting as follows:
Go to the "Synchronize" screen via the menu View -> Synchronize or by clicking this button in the toolbar:
Click the "Options" button under the list of commits:
In the options window, there's a checkbox for the "force push" setting:
By the way, when force is enabled, you should already see this below the "Options" button in step two:

How to split a patch in MQ by files within the Workbench (no command line)?

The Mercurial Workbench within TortoiseHG allows a graphical use of many mercurial functions. I have a patch sitting in a mercurial queue from which I want to extract some files to another separate patch.
I found a solution here for the command line approach:
Gaol: End up with OP=P1 + P2, where OP=Original Patch, P1=Patch 1, P2=Patch 2
Solution:
hg qpush OP
hg qrefresh <paths to keep> to replace OP with P1, including only the paths you named. The other changes will remain as uncommitted changes in the working directory.
hg qnew -f P2 to pick up those changes.
I simply cannot figure out how to do this within the workbench and would be glad if someone could teach me how to accomplish this. Thanks!
When you use the refresh button in TortoiseHg it acts on the ticked items in the list so to do what you ask you follow the following steps:
Click on your patch OP in the top list
Untick the the files that you want to go into the second patch on the list of changed files on the left
Click the refresh button on the right
Click on the working directory entry on the top list to see the rest of the files
Tick all the files on the list of changes on the left
Click on the new patch button on the right (click on the little down arrow on the commit button if that it's the active button to select the new patch button)
Obviously, enter any commit messages as required.

Annotate feature in tortoisehg

Is annotate feature available somewhere in TortoiseHg 2.x?
Yes, it is.
Open up TortoiseHg Workbench on top of your repository.
Then click the Manifest button, it looks like this in the toolbar:
In the list, find the file you want to look at, right-click and choose File History:
In the dialog that opens up, in the toolbar just above the file contents, click the button for the annotation view:
And then you should have your annotated view of the file. Note that a mouse-over on a line will show a status message at the very bottom of the window with the commit message and some details, but some details like single line changes with no content (ie. you added an empty line) might not give you a mouse-over. The revision number in the left column refers to an entry in the history list above the view though:
Yes. You can follow the steps below.
Launch TortoiseHg Workbench.
Choose Repository -> Web Server... and run the server
Browse to the repository
Choose browse option
Choose a specific file
Click on annotate