代码之家  ›  专栏  ›  技术社区  ›  Joey Adams

还有哪些存储库系统有cvs的-D(date)选项?

  •  0
  • Joey Adams  · 技术社区  · 14 年前

    # List changes made between the latest revision 24 hours ago and now
    cvs diff -D "1 day ago"
    

    3 回复  |  直到 14 年前
        1
  •  1
  •   Ned Batchelder    14 年前

    Mercurial有多种日期格式: http://www.selenic.com/mercurial/hg.1.html#date-formats ,尽管可能不是“一天前”。

    This subversion bug report date 要做到这一点:

    (2) 虽然Subversion不理解-r“{3天前}”,但date可以 帮帮我:-r“{ date -Is -d '3 days ago' }".

        2
  •  2
  •   gutch    14 年前

    Subversion也有类似的特性。例如:

    svn diff -r {2010-07-31}
    

    http://svnbook.red-bean.com/en/1.5/svn.tour.revs.specifiers.html#svn.tour.revs.dates

        3
  •  0
  •   Joey Adams    14 年前

    git日志支持在给定时间之前或之后过滤日期。例子:

    git log --after='july 17 2010' --before='july 31 2010'
    

    下面是一个shell脚本,它使列出提交范围变得更容易,但它使用的格式也比git log的默认格式更简洁:

    #!/bin/sh
    # git-changes
    
    FORMAT='%cd%x09%h%n%x09%s%n'
    CMD="git log --format=format:$FORMAT"
    
    case $# in
        0 )
            $CMD ;;
        1 )
            $CMD "--after=`date -d "$1"`" ;;
        2 )
            $CMD "--after=`date -d "$1"`" --before="`date -d "$2"`";;
    esac
    

    'July 17' 从几小时后 'July 17 2010' 因为某种原因。

    git-changes                  # Same as git log, but more terse
    git-changes 'yesterday'      # List all commits from 24 hours ago to now
    git-changes 'jul 17' 'aug 1' # List all commits after July 17 at midnight
                                 #              and before August 1 at midnight.
    

    样本输出 git-changes 'jul 17' 'aug 1' :

    Sat Jul 31 23:43:47 2010 -0400  86a6727
            * Moved libcurl into project directory as static lib.
    
    Sat Jul 31 20:04:24 2010 -0400  3a4eb10
            * Added configuration file support.
    
    Sat Jul 31 17:44:53 2010 -0400  aa2046b
            * Fixed truncation bug in bit parser.
    
    Sat Jul 17 00:10:57 2010 -0400  99e8124
            * Added support for more bits.
    

    现在,要查看commit 99e8124引入的所有更改,请键入 git show 99e8124 git diff 99e8124 .