tests/test-notify-changegroup.t
author Idan Kamara <idankk86@gmail.com>
Mon, 25 Jul 2011 15:03:02 +0300
changeset 14927 2aa3e07b2f07
parent 14868 cdd6ecfd3bcd
child 15131 7c26ce9edbd2
permissions -rw-r--r--
posix, windows: introduce cachestat This class contains a stat result, and possibly other file info to reliably determine between two points in time whether a file has changed. Uniquely identifying a file gives us that reliability because we either atomic rename or append. So one of two will happen: the file 'id' will change, or the size of the file will change. posix implements it simply by calling os.stat() and checking if the result has st_ino. For now on Windows we always assume the path is uncacheable. This can be improved on NTFS due to file IDs: http://msdn.microsoft.com/en-us/library/aa363788(v=vs.85).aspx So we need to find out if a file path is on an NTFS drive, for that we have: - GetVolumeInformation, which unfortunately only works with a root path (but is available on XP) - GetVolumeInformationByHandleW, works on a full file path but requires Vista or higher
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
     1
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     2
  $ cat <<EOF >> $HGRCPATH
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     3
  > [extensions]
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     4
  > notify=
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     5
  > 
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     6
  > [hooks]
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     7
  > changegroup.notify = python:hgext.notify.hook
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     8
  > 
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
     9
  > [notify]
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    10
  > sources = push
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    11
  > diffstat = False
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    12
  > maxsubject = 10
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    13
  > 
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    14
  > [usersubs]
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    15
  > foo@bar = *
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    16
  > 
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    17
  > [reposubs]
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    18
  > * = baz
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    19
  > EOF
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    20
  $ hg init a
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
    21
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    22
clone
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    23
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    24
  $ hg --traceback clone a b
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    25
  updating to branch default
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    26
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    27
  $ echo a > b/a
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
    28
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    29
commit
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    30
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    31
  $ hg --traceback --cwd b commit -Ama
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    32
  adding a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    33
  $ echo a >> b/a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    34
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    35
commit
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    36
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    37
  $ hg --traceback --cwd b commit -Amb
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
    38
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    39
push
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
    40
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    41
  $ hg --traceback --cwd b push ../a 2>&1 |
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    42
  >     python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    43
  pushing to ../a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    44
  searching for changes
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    45
  adding changesets
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    46
  adding manifests
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    47
  adding file changes
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    48
  added 2 changesets with 2 changes to 1 files
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    49
  Content-Type: text/plain; charset="us-ascii"
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    50
  MIME-Version: 1.0
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    51
  Content-Transfer-Encoding: 7bit
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    52
  Date: * (glob)
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    53
  Subject: * (glob)
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    54
  From: test
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    55
  X-Hg-Notification: changeset cb9a9f314b8b
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    56
  Message-Id: <*> (glob)
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    57
  To: baz, foo@bar
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    58
  
12640
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12474
diff changeset
    59
  changeset cb9a9f314b8b in $TESTTMP/a
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12474
diff changeset
    60
  details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    61
  summary: a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    62
  
12640
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12474
diff changeset
    63
  changeset ba677d0156c1 in $TESTTMP/a
6cc4b14fb76b tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents: 12474
diff changeset
    64
  details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
12474
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    65
  summary: b
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    66
  
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    67
  diffs (6 lines):
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    68
  
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    69
  diff -r 000000000000 -r ba677d0156c1 a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    70
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    71
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    72
  @@ -0,0 +1,2 @@
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    73
  +a
f213af8211cc tests: unify test-notify-changegroup
Matt Mackall <mpm@selenic.com>
parents: 11671
diff changeset
    74
  +a
14868
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    75
  $ hg --cwd a rollback
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    76
  repository tip rolled back to revision -1 (undo push)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    77
  working directory now based on revision -1
7043
b714aac1f7b3 tests: add test for notify extension as changegroup hook
Dennis Schoen <ds@1d10t.de>
parents:
diff changeset
    78
14868
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    79
unbundle with unrelated source
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    80
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    81
  $ hg --cwd b bundle ../test.hg ../a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    82
  searching for changes
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    83
  2 changesets found
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    84
  $ hg --cwd a unbundle ../test.hg
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    85
  adding changesets
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    86
  adding manifests
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    87
  adding file changes
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    88
  added 2 changesets with 2 changes to 1 files
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    89
  (run 'hg update' to get a working copy)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    90
  $ hg --cwd a rollback
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    91
  repository tip rolled back to revision -1 (undo unbundle)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    92
  working directory now based on revision -1
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    93
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    94
unbundle with correct source
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    95
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    96
  $ hg --config notify.sources=unbundle --cwd a unbundle ../test.hg 2>&1 |
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    97
  >     python -c 'import sys,re; print re.sub("\n\t", " ", sys.stdin.read()),'
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    98
  adding changesets
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
    99
  adding manifests
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   100
  adding file changes
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   101
  added 2 changesets with 2 changes to 1 files
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   102
  Content-Type: text/plain; charset="us-ascii"
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   103
  MIME-Version: 1.0
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   104
  Content-Transfer-Encoding: 7bit
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   105
  Date: * (glob)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   106
  Subject: * (glob)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   107
  From: test
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   108
  X-Hg-Notification: changeset cb9a9f314b8b
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   109
  Message-Id: <*> (glob)
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   110
  To: baz, foo@bar
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   111
  
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   112
  changeset cb9a9f314b8b in $TESTTMP/a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   113
  details: $TESTTMP/a?cmd=changeset;node=cb9a9f314b8b
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   114
  summary: a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   115
  
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   116
  changeset ba677d0156c1 in $TESTTMP/a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   117
  details: $TESTTMP/a?cmd=changeset;node=ba677d0156c1
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   118
  summary: b
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   119
  
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   120
  diffs (6 lines):
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   121
  
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   122
  diff -r 000000000000 -r ba677d0156c1 a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   123
  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   124
  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   125
  @@ -0,0 +1,2 @@
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   126
  +a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   127
  +a
cdd6ecfd3bcd test-notify-changegroup: test notifications on unbundle
Patrick Mezard <pmezard@gmail.com>
parents: 12640
diff changeset
   128
  (run 'hg update' to get a working copy)