Reputation: 22191
Is there a way in mercurial (or TortoiseHg) to do the following?
I figure I could probably look at outgoing changesets and then somehow run through each of those manually, but there must be a way to do this in a single command via the command line.
UPDATE
One extra requirement I would like is to show how the file has changed. If you go into TortoiseHg and click on the button (in the synchronize toolbar) with the tooltip filter outgoing changesets to remote repository you get a list of the draft changesets. Clicking on each changeset lists the outgoing files and has a + for additions, an x for deletions and an absence of either symbol for modifications. I would like to be able to get this information via the command line as well.
Relevant Version Information:
TortoiseHg 2.4.1
(with the following supporting software)
Mercurial 2.2.2
Python 2.6.6
Qt 4.7.4
I should also mention I'm on Windows(7x64) to prevent answers that use *nix command line utilities to pipe commands around. I could always get unxutils or cygwin etc., but I'd rather not at this time (unless no other option exists).
Upvotes: 4
Views: 781
Reputation: 97355
Two slightly different solutions
I'm too lazy to fight with excessive newlines in output, sort -u
will kill it anyway, so
Changed style-file (added status and \n before keywords, because {file_*} keywords output space-separated list, contrary to {file})
changeset = '{file_mods}\n{file_dels}\n{file_adds}'
file_mod = '\nM {file_mod}'
file_add = '\nA {file_add}'
file_del = '\nD {file_del}'
Used hg log -r "outgoing(PATH)" (may be improved, placed in [revsetalias] probably somehow)
Sample output
M 404.php
M functions.php
M readme.txt
M screenshot.png
M style.css
M readme.txt
M sidebar.php
M style.css
M comments.php
M functions.php
M header.php
M readme.txt
M sidebar.php
M style.css
M footer.php
M functions.php
M header.php
M search.php
M style.css
A readme.txt
M functions.php
M functions.php
A 404.php
A archive.php
A archives.php
A comments.php
A footer.php
A functions.php
A header.php
A html5.js
A image.php
A index.php
A license.txt
A links.php
A page.php
A screenshot.png
A search.php
A sidebar.php
A single.php
A style.css
In case of single range of outgoing (push affect only one branch) фтв availability of possibility to define outgoing first and last changeset (handwork for Windows):
hg log -r "(min(outgoing()))"
(hereinafter A)
hg log -r "(max(outgoing()))"
(hereinafter B, probably always tip)
hg status
with two specified revisions will show all changes with their respective statuses
hg st --rev A --rev B
For the same repo from solution 1 and the same range
hg st --rev 1 --rev 7
M 404.php
M comments.php
M footer.php
M functions.php
M header.php
M screenshot.png
M search.php
M sidebar.php
M style.css
A readme.txt
If working directory parent is latest changeset in outgoing range (tip and WD-parent is tip is casual case) secong revision in st
can be skipped (by default hg status
will compare with working dir) and status becomes hg status --rev A
Upvotes: 1
Reputation: 22191
I've found a way to do this, except for one more requirement I added to the question (see edit in question).
Based on this stackoverflow answer, I can list all files that have changed in changesets that are outgoing (another way of saying they are in the draft phase):
changeset = "{files}"
file = "{file}\n"
hg -q outgoing --style C:\temp\out-style.txt | sort -u
I'm using powershell to do this, so I did the following (based on my findings here) to pipe the output into a file called c:\temp\outgoing-changes.txt (addition in bold):
hg -q outgoing --style C:\temp\out-style.txt | sort -u | Out-File C:\Temp\outgoing-changes.txt -encoding UTF8
So all that is missing now is how each file changed (addition, deletion, modification). This is information I would like to know.
Upvotes: 4