tests/test-mq-qimport.t
author Idan Kamara <idankk86@gmail.com>
Tue, 06 Mar 2012 18:43:05 +0200
changeset 16238 e8eecfe37d4e
parent 16119 5de83d9ca79c
child 16359 a1b6a63f9f39
permissions -rw-r--r--
mq: no need to delete undo files after strip repair.strip takes care of that
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15446
c5c9ca3719f9 tests: use 'hghave serve' to guard tests that requires serve daemon management
Mads Kiilerich <mads@kiilerich.com>
parents: 14396
diff changeset
     1
  $ "$TESTDIR/hghave" serve || exit 80
6027
cee68264ed92 mq: qimport must read patches in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     3
  $ cat > writelines.py <<EOF
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     4
  > import sys
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     5
  > path = sys.argv[1]
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     6
  > args = sys.argv[2:]
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     7
  > assert (len(args) % 2) == 0
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     8
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
     9
  > f = file(path, 'wb')
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    10
  > for i in xrange(len(args)/2):
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    11
  >    count, s = args[2*i:2*i+2]
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    12
  >    count = int(count)
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    13
  >    s = s.decode('string_escape')
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    14
  >    f.write(s*count)
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    15
  > f.close()
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    16
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    17
  > EOF
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    18
  $ echo "[extensions]" >> $HGRCPATH
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    19
  $ echo "mq=" >> $HGRCPATH
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    20
  $ echo "[diff]" >> $HGRCPATH
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    21
  $ echo "git=1" >> $HGRCPATH
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    22
  $ hg init repo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    23
  $ cd repo
6027
cee68264ed92 mq: qimport must read patches in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    24
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    25
qimport non-existing-file
6027
cee68264ed92 mq: qimport must read patches in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
    26
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    27
  $ hg qimport non-existing-file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    28
  abort: unable to read file non-existing-file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    29
  [255]
6940
05ec27530d04 qimport: report filename in case of IOError
Martin Geisler <mg@daimi.au.dk>
parents: 6027
diff changeset
    30
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    31
import email
6940
05ec27530d04 qimport: report filename in case of IOError
Martin Geisler <mg@daimi.au.dk>
parents: 6027
diff changeset
    32
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    33
  $ hg qimport --push -n email - <<EOF
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    34
  > From: Username in email <test@example.net>
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    35
  > Subject: [PATCH] Message in email
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    36
  > Date: Fri, 02 Jan 1970 00:00:00 +0000
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    37
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    38
  > Text before patch.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    39
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    40
  > # HG changeset patch
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    41
  > # User Username in patch <test@example.net>
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    42
  > # Date 0 0
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    43
  > # Node ID 1a706973a7d84cb549823634a821d9bdf21c6220
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    44
  > # Parent  0000000000000000000000000000000000000000
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    45
  > First line of commit message.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    46
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    47
  > More text in commit message.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    48
  > --- confuse the diff detection
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    49
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    50
  > diff --git a/x b/x
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    51
  > new file mode 100644
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    52
  > --- /dev/null
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    53
  > +++ b/x
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    54
  > @@ -0,0 +1,1 @@
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    55
  > +new file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    56
  > Text after patch.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    57
  > 
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    58
  > EOF
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    59
  adding email to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    60
  applying email
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    61
  now at: email
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
    62
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    63
hg tip -v
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
    64
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    65
  $ hg tip -v
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    66
  changeset:   0:1a706973a7d8
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    67
  tag:         email
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    68
  tag:         qbase
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    69
  tag:         qtip
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    70
  tag:         tip
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    71
  user:        Username in patch <test@example.net>
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    72
  date:        Thu Jan 01 00:00:00 1970 +0000
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    73
  files:       x
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    74
  description:
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    75
  First line of commit message.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    76
  
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    77
  More text in commit message.
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    78
  
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    79
  
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    80
  $ hg qpop
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    81
  popping email
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    82
  patch queue now empty
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    83
  $ hg qdelete email
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
    84
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    85
import URL
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    86
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    87
  $ echo foo >> foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    88
  $ hg add foo
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12464
diff changeset
    89
  $ hg diff > url.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    90
  $ hg revert --no-backup foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    91
  $ rm foo
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
    92
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    93
Under unix: file:///foobar/blah
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    94
Under windows: file:///c:/foobar/blah
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
    95
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12464
diff changeset
    96
  $ patchurl=`pwd | tr '\\\\' /`/url.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    97
  $ expr "$patchurl" : "\/" > /dev/null || patchurl="/$patchurl"
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    98
  $ hg qimport file://"$patchurl"
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
    99
  adding url.diff to series file
12642
bb35840e965c tests: remove the last traces of $HGTMP
Mads Kiilerich <mads@kiilerich.com>
parents: 12464
diff changeset
   100
  $ rm url.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   101
  $ hg qun
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   102
  url.diff
9287
53fdf18fd63b mq: Parse commit message after we find start of changeset patch
David Soria Parra <dsp@php.net>
parents: 8362
diff changeset
   103
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   104
import patch that already exists
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   105
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   106
  $ echo foo2 >> foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   107
  $ hg add foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   108
  $ hg diff > ../url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   109
  $ hg revert --no-backup foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   110
  $ rm foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   111
  $ hg qimport ../url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   112
  abort: patch "url.diff" already exists
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   113
  [255]
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   114
  $ hg qpush
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   115
  applying url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   116
  now at: url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   117
  $ cat foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   118
  foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   119
  $ hg qpop
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   120
  popping url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   121
  patch queue now empty
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   122
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   123
qimport -f
7158
d1d011accf94 mq: let qimport read patches from URLs
Brendan Cully <brendan@kublai.com>
parents: 6940
diff changeset
   124
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   125
  $ hg qimport -f ../url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   126
  adding url.diff to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   127
  $ hg qpush
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   128
  applying url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   129
  now at: url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   130
  $ cat foo
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   131
  foo2
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   132
  $ hg qpop
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   133
  popping url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   134
  patch queue now empty
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   135
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   136
build diff with CRLF
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   137
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   138
  $ python ../writelines.py b 5 'a\n' 5 'a\r\n'
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   139
  $ hg ci -Am addb
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   140
  adding b
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   141
  $ python ../writelines.py b 2 'a\n' 10 'b\n' 2 'a\r\n'
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   142
  $ hg diff > b.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   143
  $ hg up -C
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   144
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   145
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   146
qimport CRLF diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   147
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   148
  $ hg qimport b.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   149
  adding b.diff to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   150
  $ hg qpush
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   151
  applying b.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   152
  now at: b.diff
7160
1b7b21b634f2 mq: make qimport -f work properly. Closes issue1255.
Brendan Cully <brendan@kublai.com>
parents: 7158
diff changeset
   153
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   154
try to import --push
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   155
16119
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   156
  $ cat > appendfoo.diff <<EOF
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   157
  > append foo
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   158
  >  
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   159
  > diff -r 07f494440405 -r 261500830e46 baz
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   160
  > --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   161
  > +++ b/baz	Thu Jan 01 00:00:00 1970 +0000
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   162
  > @@ -0,0 +1,1 @@
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   163
  > +foo
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   164
  > EOF
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   165
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   166
  $ cat > appendbar.diff <<EOF
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   167
  > append bar
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   168
  >  
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   169
  > diff -r 07f494440405 -r 261500830e46 baz
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   170
  > --- a/baz	Thu Jan 01 00:00:00 1970 +0000
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   171
  > +++ b/baz	Thu Jan 01 00:00:00 1970 +0000
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   172
  > @@ -1,1 +1,2 @@
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   173
  >  foo
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   174
  > +bar
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   175
  > EOF
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   176
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   177
  $ hg qimport --push appendfoo.diff appendbar.diff
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   178
  adding appendfoo.diff to series file
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   179
  adding appendbar.diff to series file
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   180
  applying appendfoo.diff
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   181
  applying appendbar.diff
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   182
  now at: appendbar.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   183
  $ hg qfin -a
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   184
  patch b.diff finalized without changeset message
16119
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   185
  $ hg qimport -r 'p1(.)::' -P
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   186
  $ hg qpop -a
16119
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   187
  popping 3.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   188
  popping 2.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   189
  patch queue now empty
16119
5de83d9ca79c mq: make qimport --push push all imported patches (issue3130)
Patrick Mezard <patrick@mezard.eu>
parents: 16027
diff changeset
   190
  $ hg qdel 3.diff
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   191
  $ hg qdel -k 2.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   192
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   193
qimport -e
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   194
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   195
  $ hg qimport -e 2.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   196
  adding 2.diff to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   197
  $ hg qdel -k 2.diff
6027
cee68264ed92 mq: qimport must read patches in binary mode
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
   198
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   199
qimport -e --name newname oldexisitingpatch
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   200
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   201
  $ hg qimport -e --name this-name-is-better 2.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   202
  renaming 2.diff to this-name-is-better
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   203
  adding this-name-is-better to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   204
  $ hg qser
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   205
  this-name-is-better
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   206
  url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   207
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   208
qimport -e --name without --force
11699
da0b9109186d mq: support "qimport --existing --name renametothis thatexistingpatch"
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 10775
diff changeset
   209
12464
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   210
  $ cp .hg/patches/this-name-is-better .hg/patches/3.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   211
  $ hg qimport -e --name this-name-is-better 3.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   212
  abort: patch "this-name-is-better" already exists
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   213
  [255]
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   214
  $ hg qser
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   215
  this-name-is-better
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   216
  url.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   217
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   218
qimport -e --name with --force
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   219
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   220
  $ hg qimport --force -e --name this-name-is-better 3.diff
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   221
  renaming 3.diff to this-name-is-better
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   222
  adding this-name-is-better to series file
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   223
  $ hg qser
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   224
  this-name-is-better
3177e3a7b14f tests: unify test-mq-qimport
Matt Mackall <mpm@selenic.com>
parents: 11701
diff changeset
   225
  url.diff
14395
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   226
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   227
qimport with bad name, should abort before reading file
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   228
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   229
  $ hg qimport non-existant-file --name .hg
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   230
  abort: patch name cannot begin with ".hg"
dc961471efde mq: check patch name is valid before reading imported file
Idan Kamara <idankk86@gmail.com>
parents: 12642
diff changeset
   231
  [255]
14396
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   232
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   233
qimport http:// patch with leading slashes in url
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   234
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   235
set up hgweb
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   236
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   237
  $ cd ..
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   238
  $ hg init served
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   239
  $ cd served
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   240
  $ echo a > a
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   241
  $ hg ci -Am patch
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   242
  adding a
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   243
  $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   244
  $ cat hg.pid >> $DAEMON_PIDS
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   245
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   246
  $ cd ../repo
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   247
  $ hg qimport http://localhost:$HGPORT/raw-rev/0///
170747a3e139 mq: strip all leading slashes from url when importing
Idan Kamara <idankk86@gmail.com>
parents: 14395
diff changeset
   248
  adding 0 to series file
16027
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   249
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   250
check qimport phase:
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   251
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   252
  $ hg -q qpush
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   253
  now at: 0
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   254
  $ hg phase qparent
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   255
  1: draft
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   256
  $ hg qimport -r qparent
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   257
  $ hg phase qbase
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   258
  1: draft
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   259
  $ hg qfinish qbase
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   260
  $ echo '[mq]' >> $HGRCPATH
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   261
  $ echo 'secret=true' >> $HGRCPATH
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   262
  $ hg qimport -r qparent
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   263
  $ hg phase qbase
29ea059be33c qimport: when mq.secret=True set qimported revision as secret
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 15934
diff changeset
   264
  1: secret