Mercurial - How do I create a .zip of files changed between two revisions?

前端 未结 9 2158
迷失自我
迷失自我 2021-02-04 16:29

I have a personal Mercurial repository tracking some changes I am working on. I\'d like to share these changes with a collaborator, however they don\'t have/can\'t get Mercuria

9条回答
  •  无人共我
    2021-02-04 16:55

    Here is a small and ugly bash script that will do the job, at least if you work in an Linux environment. This has absolutely no checks what so ever and will most likely break when you have moved a file but it is a start.

    Command:

    zipChanges.sh REVISION REPOSITORY DESTINATION
    zipChanges.sh 3 /home/hg/repo /home/hg/files.tgz
    

    Code:

    #!/bin/sh
    REV=$1
    SRC_REPO=$2
    DST_ZIP=$3
    
    cd $SRC_REPO
    FILES=$(hg status --rev $1 $SRC_REPO | cut -c3-)
    
    IFS=$'\n'
    FILENAMES=""
    for line in ${FILES}
    do
        FILENAMES=$FILENAMES" \""$SRC_REPO"/"$line"\""
    done
    
    CMD="tar czf \"$DST_ZIP\" $FILENAMES"
    
    eval $CMD
    

提交回复
热议问题