In Mercurial (hg), how do you see a list of files that will be pushed if an “hg push” is issued?

前端 未结 5 1886
后悔当初
后悔当初 2020-12-14 08:06

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.

相关标签:
5条回答
  • 2020-12-14 08:51

    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
    
    0 讨论(0)
  • 2020-12-14 08:51

    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):
    
    0 讨论(0)
  • 2020-12-14 08:52

    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.

    0 讨论(0)
  • 2020-12-14 09:07

    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.

    0 讨论(0)
  • A simple hg out will also solve this. It will list all committed but yet to push checkins.

    0 讨论(0)
提交回复
热议问题