tests/test-git-export.t
changeset 24432 e22248f6d257
parent 19973 1184edaead7a
child 24455 16961d43dc89
equal deleted inserted replaced
24431:a0004402776b 24432:e22248f6d257
     3   $ hg ci -Amstart
     3   $ hg ci -Amstart
     4   adding start
     4   adding start
     5 
     5 
     6 New file:
     6 New file:
     7 
     7 
     8   $ echo new > new
     8   $ mkdir dir1
       
     9   $ echo new > dir1/new
     9   $ hg ci -Amnew
    10   $ hg ci -Amnew
    10   adding new
    11   adding dir1/new
    11   $ hg diff --git -r 0
    12   $ hg diff --git -r 0
    12   diff --git a/new b/new
    13   diff --git a/dir1/new b/dir1/new
    13   new file mode 100644
    14   new file mode 100644
    14   --- /dev/null
    15   --- /dev/null
    15   +++ b/new
    16   +++ b/dir1/new
    16   @@ -0,0 +1,1 @@
    17   @@ -0,0 +1,1 @@
    17   +new
    18   +new
    18 
    19 
    19 Copy:
    20 Copy:
    20 
    21 
    21   $ hg cp new copy
    22   $ mkdir dir2
       
    23   $ hg cp dir1/new dir1/copy
       
    24   $ echo copy1 >> dir1/copy
       
    25   $ hg cp dir1/new dir2/copy
       
    26   $ echo copy2 >> dir2/copy
    22   $ hg ci -mcopy
    27   $ hg ci -mcopy
    23   $ hg diff --git -r 1:tip
    28   $ hg diff --git -r 1:tip
       
    29   diff --git a/dir1/new b/dir1/copy
       
    30   copy from dir1/new
       
    31   copy to dir1/copy
       
    32   --- a/dir1/new
       
    33   +++ b/dir1/copy
       
    34   @@ -1,1 +1,2 @@
       
    35    new
       
    36   +copy1
       
    37   diff --git a/dir1/new b/dir2/copy
       
    38   copy from dir1/new
       
    39   copy to dir2/copy
       
    40   --- a/dir1/new
       
    41   +++ b/dir2/copy
       
    42   @@ -1,1 +1,2 @@
       
    43    new
       
    44   +copy2
       
    45 
       
    46 Cross and same-directory copies with a relative root:
       
    47 
       
    48   $ hg diff --git --relative .. -r 1:tip
       
    49   abort: .. not under root '$TESTTMP'
       
    50   [255]
       
    51   $ hg diff --git --relative doesnotexist -r 1:tip
       
    52   $ hg diff --git --relative . -r 1:tip
       
    53   diff --git a/dir1/new b/dir1/copy
       
    54   copy from dir1/new
       
    55   copy to dir1/copy
       
    56   --- a/dir1/new
       
    57   +++ b/dir1/copy
       
    58   @@ -1,1 +1,2 @@
       
    59    new
       
    60   +copy1
       
    61   diff --git a/dir1/new b/dir2/copy
       
    62   copy from dir1/new
       
    63   copy to dir2/copy
       
    64   --- a/dir1/new
       
    65   +++ b/dir2/copy
       
    66   @@ -1,1 +1,2 @@
       
    67    new
       
    68   +copy2
       
    69   $ hg diff --git --relative dir1 -r 1:tip
    24   diff --git a/new b/copy
    70   diff --git a/new b/copy
    25   copy from new
    71   copy from new
    26   copy to copy
    72   copy to copy
       
    73   --- a/new
       
    74   +++ b/copy
       
    75   @@ -1,1 +1,2 @@
       
    76    new
       
    77   +copy1
       
    78 
       
    79   $ hg diff --git --relative dir2/ -r 1:tip
       
    80   diff --git a/copy b/copy
       
    81   new file mode 100644
       
    82   --- /dev/null
       
    83   +++ b/copy
       
    84   @@ -0,0 +1,2 @@
       
    85   +new
       
    86   +copy2
       
    87 
       
    88   $ hg diff --git --relative dir1 -r 1:tip -I '**/copy'
       
    89   diff --git a/new b/copy
       
    90   copy from new
       
    91   copy to copy
       
    92   --- a/new
       
    93   +++ b/copy
       
    94   @@ -1,1 +1,2 @@
       
    95    new
       
    96   +copy1
       
    97 
       
    98   $ hg diff --git --relative dir1 -r 1:tip dir2
       
    99   warning: dir2 not inside relative root dir1
       
   100 
       
   101   $ hg diff --git --relative dir1 -r 1:tip 'dir2/{copy}'
       
   102   warning: dir2/{copy} not inside relative root dir1
       
   103 
       
   104   $ cd dir1
       
   105   $ hg diff --git --relative .. -r 1:tip
       
   106   diff --git a/dir1/new b/dir1/copy
       
   107   copy from dir1/new
       
   108   copy to dir1/copy
       
   109   --- a/dir1/new
       
   110   +++ b/dir1/copy
       
   111   @@ -1,1 +1,2 @@
       
   112    new
       
   113   +copy1
       
   114   diff --git a/dir1/new b/dir2/copy
       
   115   copy from dir1/new
       
   116   copy to dir2/copy
       
   117   --- a/dir1/new
       
   118   +++ b/dir2/copy
       
   119   @@ -1,1 +1,2 @@
       
   120    new
       
   121   +copy2
       
   122 
       
   123   $ hg diff --git --relative ../.. -r 1:tip
       
   124   abort: ../.. not under root '$TESTTMP'
       
   125   [255]
       
   126   $ hg diff --git --relative ../doesnotexist -r 1:tip
       
   127   $ hg diff --git --relative .. -r 1:tip
       
   128   diff --git a/dir1/new b/dir1/copy
       
   129   copy from dir1/new
       
   130   copy to dir1/copy
       
   131   --- a/dir1/new
       
   132   +++ b/dir1/copy
       
   133   @@ -1,1 +1,2 @@
       
   134    new
       
   135   +copy1
       
   136   diff --git a/dir1/new b/dir2/copy
       
   137   copy from dir1/new
       
   138   copy to dir2/copy
       
   139   --- a/dir1/new
       
   140   +++ b/dir2/copy
       
   141   @@ -1,1 +1,2 @@
       
   142    new
       
   143   +copy2
       
   144 
       
   145   $ hg diff --git --relative . -r 1:tip
       
   146   diff --git a/new b/copy
       
   147   copy from new
       
   148   copy to copy
       
   149   --- a/new
       
   150   +++ b/copy
       
   151   @@ -1,1 +1,2 @@
       
   152    new
       
   153   +copy1
       
   154   $ hg diff --git --relative . -r 1:tip copy
       
   155   diff --git a/new b/copy
       
   156   copy from new
       
   157   copy to copy
       
   158   --- a/new
       
   159   +++ b/copy
       
   160   @@ -1,1 +1,2 @@
       
   161    new
       
   162   +copy1
       
   163   $ hg diff --git --relative . -r 1:tip ../dir2
       
   164   warning: ../dir2 not inside relative root .
       
   165   $ hg diff --git --relative . -r 1:tip '../dir2/*'
       
   166   warning: ../dir2/* not inside relative root .
       
   167   $ cd ..
    27 
   168 
    28 Rename:
   169 Rename:
    29 
   170 
    30   $ hg mv copy rename
   171   $ hg mv dir1/copy dir1/rename1
       
   172   $ echo rename1 >> dir1/rename1
       
   173   $ hg mv dir2/copy dir1/rename2
       
   174   $ echo rename2 >> dir1/rename2
    31   $ hg ci -mrename
   175   $ hg ci -mrename
    32   $ hg diff --git -r 2:tip
   176   $ hg diff --git -r 2:tip
    33   diff --git a/copy b/rename
   177   diff --git a/dir1/copy b/dir1/rename1
       
   178   rename from dir1/copy
       
   179   rename to dir1/rename1
       
   180   --- a/dir1/copy
       
   181   +++ b/dir1/rename1
       
   182   @@ -1,2 +1,3 @@
       
   183    new
       
   184    copy1
       
   185   +rename1
       
   186   diff --git a/dir2/copy b/dir1/rename2
       
   187   rename from dir2/copy
       
   188   rename to dir1/rename2
       
   189   --- a/dir2/copy
       
   190   +++ b/dir1/rename2
       
   191   @@ -1,2 +1,3 @@
       
   192    new
       
   193    copy2
       
   194   +rename2
       
   195 
       
   196 Cross and same-directory renames with a relative root:
       
   197 
       
   198   $ hg diff --relative dir1 --git -r 2:tip
       
   199   diff --git a/copy b/rename1
    34   rename from copy
   200   rename from copy
    35   rename to rename
   201   rename to rename1
       
   202   --- a/copy
       
   203   +++ b/rename1
       
   204   @@ -1,2 +1,3 @@
       
   205    new
       
   206    copy1
       
   207   +rename1
       
   208   diff --git a/rename2 b/rename2
       
   209   new file mode 100644
       
   210   --- /dev/null
       
   211   +++ b/rename2
       
   212   @@ -0,0 +1,3 @@
       
   213   +new
       
   214   +copy2
       
   215   +rename2
       
   216 
       
   217   $ hg diff --relative dir2 --git -r 2:tip
       
   218   diff --git a/copy b/copy
       
   219   deleted file mode 100644
       
   220   --- a/copy
       
   221   +++ /dev/null
       
   222   @@ -1,2 +0,0 @@
       
   223   -new
       
   224   -copy2
       
   225 
       
   226   $ hg diff --relative dir1 --git -r 2:tip -I '**/copy'
       
   227   diff --git a/copy b/copy
       
   228   deleted file mode 100644
       
   229   --- a/copy
       
   230   +++ /dev/null
       
   231   @@ -1,2 +0,0 @@
       
   232   -new
       
   233   -copy1
       
   234 
       
   235   $ hg diff --relative dir1 --git -r 2:tip -I '**/rename*'
       
   236   diff --git a/copy b/rename1
       
   237   copy from copy
       
   238   copy to rename1
       
   239   --- a/copy
       
   240   +++ b/rename1
       
   241   @@ -1,2 +1,3 @@
       
   242    new
       
   243    copy1
       
   244   +rename1
       
   245   diff --git a/rename2 b/rename2
       
   246   new file mode 100644
       
   247   --- /dev/null
       
   248   +++ b/rename2
       
   249   @@ -0,0 +1,3 @@
       
   250   +new
       
   251   +copy2
       
   252   +rename2
    36 
   253 
    37 Delete:
   254 Delete:
    38 
   255 
    39   $ hg rm rename
   256   $ hg rm dir1/*
    40   $ hg ci -mdelete
   257   $ hg ci -mdelete
    41   $ hg diff --git -r 3:tip
   258   $ hg diff --git -r 3:tip
    42   diff --git a/rename b/rename
   259   diff --git a/dir1/new b/dir1/new
    43   deleted file mode 100644
   260   deleted file mode 100644
    44   --- a/rename
   261   --- a/dir1/new
    45   +++ /dev/null
   262   +++ /dev/null
    46   @@ -1,1 +0,0 @@
   263   @@ -1,1 +0,0 @@
    47   -new
   264   -new
       
   265   diff --git a/dir1/rename1 b/dir1/rename1
       
   266   deleted file mode 100644
       
   267   --- a/dir1/rename1
       
   268   +++ /dev/null
       
   269   @@ -1,3 +0,0 @@
       
   270   -new
       
   271   -copy1
       
   272   -rename1
       
   273   diff --git a/dir1/rename2 b/dir1/rename2
       
   274   deleted file mode 100644
       
   275   --- a/dir1/rename2
       
   276   +++ /dev/null
       
   277   @@ -1,3 +0,0 @@
       
   278   -new
       
   279   -copy2
       
   280   -rename2
    48 
   281 
    49   $ cat > src <<EOF
   282   $ cat > src <<EOF
    50   > 1
   283   > 1
    51   > 2
   284   > 2
    52   > 3
   285   > 3