tags:

views:

111

answers:

4

We can see all the changesets and the files involved using

hg outgoing -v

but the filenames are all scattered in the list of changesets.

Is there a way to just see a list of all the files that will go out if hg push is issued?

+2  A: 

I use Torgoise Hg, which is a shell extension that has a "synchronize" view allowing you to see outgoing files before you push them. It's convenient for commits as well, and other things.

Robusto
ah, command line should have that too... but not sure how
動靜能量
My preferred way as well, when Im not stuck in a console.
mizipzor
I use a Macbook Pro with Snow Leopard on it... seems like the Windows guys have TortouseHg but the Mac guys are stuck with the command line!
動靜能量
Jian Lin: see MacHg for a graphical Mercurial client: http://jasonfharris.com/machg/ I don't know if it can show you a list of outgoing files, though.
Martin Geisler
+2  A: 

First, create a file with this content:

changeset = "{files}"
file = "{file}\n"

Let's say you call it out-style.txt and put it in your home directory. Then you can give this command:

hg -q outgoing --style ~/out-style.txt | sort -u
JWWalker
great thanks! wow... this is not often needed that there is no standard way to list all files that will be pushed? I mean, isn't it useful to see something like that before we do a push? For example, right now, when I do "hg out -v", I see a list of 20 changesets and individual file and file lists... and I have to mentally combine the names... and this is a Ruby on Rails project where there are tons of files.
動靜能量
I guess it all depends on how you work. At the end of each day, I just push when anything is outgoing. I don't need to know which changesets or files will be pushed.
JWWalker
Agreed with JWWalker, it's really not something you're normally concerned about. However it seems like it would be a trivial extension to write if you really wanted the functionality more easily.
dimo414
the reason was that, back in the SVN days, before I commit to the central repository, I will diff every file, re-read the changes I made, line by line and character by character, before I really commit and do a push to all the production servers. Some of my coworkers just go play video games with the CTO instead, and they actually get a better performance reviews even if they break the whole system sometimes, as they are "good buddies" of the CTO.
動靜能量
by the way, you can push every day? Is that push to the live server each day? Or do you push to a server first and every few days or 1 or 2 weeks, push to the production servers?
動靜能量
+2  A: 

I usually use

hg outgoing -v | grep files

It makes the listing shorter, but doesnt sort. But thus far I havent been in a situation where I want to push so much (and at the same time check the files) that its been a problem.

[Edit] To do what you want:

  • Use cut to remove the files: part
  • For changesets with more than one touched file, use tr to put them on separate lines
  • Finally sort the resulting output with sort

Like so:

hg outgoing -v |grep files: |cut -c 14- |tr ' ' '\n' |sort -u

You can put this in ~/outgoingfiles.sh or something to have it nice and ready.

mizipzor
That method has the disadvantage that file names within a changeset are separated by spaces. If you have any file names that contain spaces, then there is no way to automatically separate the file names before sorting.
JWWalker
A: 

A somewhat under-appreciated feature: hg status can show information about changes in file status between arbitrary changesets. This can be used to get a list of files changed between revisions X and Y:

hg status --rev X:Y

In this case, we can use hg outgoing, to find the first outgoing changeset X and then do

hg status --rev X:

to see the files changes since revision X. You can combine this into a single line in your shell:

hg status --rev $(hg outgoing -q --template '{node}' -l 1):
Martin Geisler
i thought "hg status" is between working directory and local repository, while "hg outgoing" is between 2 repositories?
動靜能量
Yes -- 99% of the time, you use `hg status` to show the differences between the parent revision of the working copy and the working copy itself. But you can ask for the file status between any two revisions. So above I simply use `hg outgoing` to learn about the first outgoing changeset and then ask `hg status` to show changes from that changeset.
Martin Geisler