开发者

cvs return status of working copy revision

I'm working on a puppet manifest to deploy our code from a cvs repository. I have the following so far:

define codedeploy::cvs ($module, $tag, $copydir) {

    file { "$copydir":
        owner => www-data,
        group => www-data,
        mode => 755,
        ensure => directory
    }

    #bypass cvs login, we'll just inject a ~/.cvspass file
        # to do

    #initial cvs 开发者_运维技巧checkout
    exec { "cvscheckout-$name":
        command => "cvs co -r $tag -d $name $module",
        creates => "$copydir/$name/CVS",
        require => [Package[cvs], File["$copydir"]],
        environment => "CVSROOT=:pserver:robots@codeserver:/cvs/repository",
        cwd => "$copydir"
    }

    #cvs update to tag
    exec { "cvsupdate-$name":
        command => "cvs up -r $tag",
        require => [Package[cvs], File["$copydir"], Exec["cvscheckout-$name"] ],
        environment => "CVSROOT=:pserver:robots@codeserver:/cvs/repository",
        cwd => "$copydir/$name",
        unless => #NEED TO FIGURE THIS PART OUT!
    }
}

The part which I don't know is how I can return the revision status of the working copy, so that it won't call cvs update every puppet run. Does cvs has a command to return the current tag or revision id of the entire working tree? When I do a cvs diff it seems to know it should be diffing all the files under that tag, however I'm not sure how I can just return the tag id for my working copy after I've checked it out.

Thanks!


I would guess that you can use cvs status to see if you need to check any changes in.

However, what's the harm in just running cvs up every time? I have cron jobs that do the same thing hourly or daily, and I don't think it's much of an issue. If your codebase is ginormous I suppose that's a reason :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜