首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用ant脚本从vss获取基于修改日期的最新文件

如何使用ant脚本从vss获取基于修改日期的最新文件
EN

Stack Overflow用户
提问于 2011-11-16 09:31:37
回答 1查看 687关注 0票数 1

我编写了ant脚本,以便从vss获得最新的修改文件。

代码语言:javascript
复制
<target name="prepare">
    <vssget localPath="C:\build"
            date="11/16/2011"
            recursive="true"
            login="ss,ss"
            vsspath="$\PIS" filetimestamp="modified"/>
</target>

如果我正在执行上面的ant脚本,我会从vss获得所有文件。我需要基于给定日期的文件。请帮帮我。

EN

回答 1

Stack Overflow用户

发布于 2011-11-16 10:43:37

org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET类的源代码中可以看出:

代码语言:javascript
复制
/**
 * Builds a command line to execute ss.
 * @return     The constructed commandline.
 */
Commandline buildCmdLine() {
    Commandline commandLine = new Commandline();

    // build the command line from what we got the format is
    // ss Get VSS items [-G] [-H] [-I-] [-N] [-O] [-R] [-V] [-W] [-Y] [-?]
    // as specified in the SS.EXE help
    commandLine.setExecutable(getSSCommand());
    commandLine.createArgument().setValue(COMMAND_GET);

    if (getVsspath() == null) {
        throw new BuildException("vsspath attribute must be set!", getLocation());
    }
    commandLine.createArgument().setValue(getVsspath());

    // -GL
    commandLine.createArgument().setValue(getLocalpath());
    // -I- or -I-Y or -I-N
    commandLine.createArgument().setValue(getAutoresponse());
    // -O-
    commandLine.createArgument().setValue(getQuiet());
    // -R
    commandLine.createArgument().setValue(getRecursive());
    // -V
    commandLine.createArgument().setValue(getVersionDateLabel());
    // -W
    commandLine.createArgument().setValue(getWritable());
    // -Y
    commandLine.createArgument().setValue(getLogin());
    // -G
    commandLine.createArgument().setValue(getFileTimeStamp());
    // -GWS or -GWR
    commandLine.createArgument().setValue(getWritableFiles());

    return commandLine;
}

org.apache.tools.ant.taskdefs.optional.vss.MSVSS类:

代码语言:javascript
复制
/**
 * Gets the version string. Returns the first specified of version "-V1.0",
 * date "-Vd01.01.01", label "-Vlbuild1".
 * @return An empty string if a version, date and label are not set.
 */
protected String getVersionDateLabel() {
    String versionDateLabel = "";
    if (version != null) {
        versionDateLabel = FLAG_VERSION + version;
    } else if (date != null) {
        versionDateLabel = FLAG_VERSION_DATE + date;
    } else {
        // Use getShortLabel() so labels longer then 30 char are truncated
        // and the user is warned
        String shortLabel = getShortLabel();
        if (shortLabel != null && !shortLabel.equals("")) {
            versionDateLabel = FLAG_VERSION_LABEL + shortLabel;
        }
    }
    return versionDateLabel;
}

您应该设置date任务的vssget属性。

尝试以不同的格式设置date属性值(MM/dd/yy;hh:mmamm/dd/yyyy;h:mmadd.mm.yyyy)。这篇文章这个职位可以帮助您找到正确的格式。

正确的日期时间格式( IMHO )取决于VSS数据库的区域设置。这个发行邮寄是关于解决一个类似的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8149392

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档