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