##// END OF EJS Templates
tests: update test-remotefilelog-gc.t for Python 3.11...
Mads Kiilerich -
r52005:8037ddac stable
parent child Browse files
Show More
@@ -1,111 +1,116 b''
1 1 #require no-windows
2 2
3 3 $ . "$TESTDIR/remotefilelog-library.sh"
4 4
5 5 $ hg init master
6 6 $ cd master
7 7 $ cat >> .hg/hgrc <<EOF
8 8 > [remotefilelog]
9 9 > server=True
10 10 > serverexpiration=-1
11 11 > EOF
12 12 $ echo x > x
13 13 $ hg commit -qAm x
14 14 $ cd ..
15 15
16 16 $ hgcloneshallow ssh://user@dummy/master shallow -q
17 17 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
18 18
19 19 # Set the prefetchdays config to zero so that all commits are prefetched
20 20 # no matter what their creation date is.
21 21 $ cd shallow
22 22 $ cat >> .hg/hgrc <<EOF
23 23 > [remotefilelog]
24 24 > prefetchdays=0
25 25 > EOF
26 26 $ cd ..
27 27
28 28 # commit a new version of x so we can gc the old one
29 29
30 30 $ cd master
31 31 $ echo y > x
32 32 $ hg commit -qAm y
33 33 $ cd ..
34 34
35 35 $ cd shallow
36 36 $ hg pull -q
37 37 $ hg update -q
38 38 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
39 39 $ cd ..
40 40
41 41 # gc client cache
42 42
43 43 $ lastweek=`"$PYTHON" -c 'import datetime,time; print(datetime.datetime.fromtimestamp(time.time() - (86400 * 7)).strftime("%y%m%d%H%M"))'`
44 44 $ find $CACHEDIR -type f -exec touch -t $lastweek {} \;
45 45
46 46 $ find $CACHEDIR -type f | sort
47 47 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 (glob)
48 48 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/48023ec064c1d522f0d792a5a912bb1bf7859a4a (glob)
49 49 $TESTTMP/hgcache/repos (glob)
50 50 $ hg gc
51 51 finished: removed 1 of 2 files (0.00 GB to 0.00 GB)
52 52 $ find $CACHEDIR -type f | sort
53 53 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/48023ec064c1d522f0d792a5a912bb1bf7859a4a (glob)
54 54 $TESTTMP/hgcache/repos
55 55
56 56 # gc server cache
57 57
58 58 $ find master/.hg/remotefilelogcache -type f | sort
59 59 master/.hg/remotefilelogcache/x/1406e74118627694268417491f018a4a883152f0 (glob)
60 60 master/.hg/remotefilelogcache/x/48023ec064c1d522f0d792a5a912bb1bf7859a4a (glob)
61 61 $ hg gc master
62 62 finished: removed 0 of 1 files (0.00 GB to 0.00 GB)
63 63 $ find master/.hg/remotefilelogcache -type f | sort
64 64 master/.hg/remotefilelogcache/x/48023ec064c1d522f0d792a5a912bb1bf7859a4a (glob)
65 65
66 66 # Test that GC keepset includes pullprefetch revset if it is configured
67 67
68 68 $ cd shallow
69 69 $ cat >> .hg/hgrc <<EOF
70 70 > [remotefilelog]
71 71 > pullprefetch=all()
72 72 > EOF
73 73 $ hg prefetch
74 74 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
75 75
76 76 $ cd ..
77 77 $ hg gc
78 78 finished: removed 0 of 2 files (0.00 GB to 0.00 GB)
79 79
80 80 # Ensure that there are 2 versions of the file in cache
81 81 $ find $CACHEDIR -type f | sort
82 82 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0 (glob)
83 83 $TESTTMP/hgcache/master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/48023ec064c1d522f0d792a5a912bb1bf7859a4a (glob)
84 84 $TESTTMP/hgcache/repos (glob)
85 85
86 86 # Test that if garbage collection on repack and repack on hg gc flags are set then incremental repack with garbage collector is run
87 87
88 88 $ hg gc --config remotefilelog.gcrepack=True --config remotefilelog.repackonhggc=True
89 89
90 90 # Ensure that loose files are repacked
91 91 $ find $CACHEDIR -type f | sort
92 92 $TESTTMP/hgcache/master/packs/320dab99b7e3f60512b97f347689625263d22cf5.dataidx
93 93 $TESTTMP/hgcache/master/packs/320dab99b7e3f60512b97f347689625263d22cf5.datapack
94 94 $TESTTMP/hgcache/master/packs/837b83c1ef6485a336eb4421ac5973c0ec130fbb.histidx
95 95 $TESTTMP/hgcache/master/packs/837b83c1ef6485a336eb4421ac5973c0ec130fbb.histpack
96 96 $TESTTMP/hgcache/repos
97 97
98 98 # Test that warning is displayed when there are no valid repos in repofile
99 99
100 100 $ cp $CACHEDIR/repos $CACHEDIR/repos.bak
101 101 $ echo " " > $CACHEDIR/repos
102 102 $ hg gc
103 103 warning: no valid repos in repofile
104 104 $ mv $CACHEDIR/repos.bak $CACHEDIR/repos
105 105
106 106 # Test that warning is displayed when the repo path is malformed
107 107
108 108 $ printf "asdas\0das" >> $CACHEDIR/repos
109 #if py311
110 $ hg gc
111 finished: removed 0 of 4 files (0.00 GB to 0.00 GB)
112 #else
109 113 $ hg gc
110 114 abort: invalid path asdas\x00da: .*(null|NULL).* (re)
111 115 [255]
116 #endif
General Comments 0
You need to be logged in to leave comments. Login now