Show More
@@ -1,153 +1,153 | |||||
1 | Journal extension test: tests the share extension support |
|
1 | Journal extension test: tests the share extension support | |
2 |
|
2 | |||
3 | $ cat >> testmocks.py << EOF |
|
3 | $ cat >> testmocks.py << EOF | |
4 | > # mock out util.getuser() and util.makedate() to supply testable values |
|
4 | > # mock out util.getuser() and util.makedate() to supply testable values | |
5 | > import os |
|
5 | > import os | |
6 | > from mercurial import util |
|
6 | > from mercurial import util | |
7 | > def mockgetuser(): |
|
7 | > def mockgetuser(): | |
8 | > return 'foobar' |
|
8 | > return 'foobar' | |
9 | > |
|
9 | > | |
10 | > def mockmakedate(): |
|
10 | > def mockmakedate(): | |
11 | > filename = os.path.join(os.environ['TESTTMP'], 'testtime') |
|
11 | > filename = os.path.join(os.environ['TESTTMP'], 'testtime') | |
12 | > try: |
|
12 | > try: | |
13 | > with open(filename, 'rb') as timef: |
|
13 | > with open(filename, 'rb') as timef: | |
14 | > time = float(timef.read()) + 1 |
|
14 | > time = float(timef.read()) + 1 | |
15 | > except IOError: |
|
15 | > except IOError: | |
16 | > time = 0.0 |
|
16 | > time = 0.0 | |
17 | > with open(filename, 'wb') as timef: |
|
17 | > with open(filename, 'wb') as timef: | |
18 | > timef.write(str(time)) |
|
18 | > timef.write(str(time)) | |
19 | > return (time, 0) |
|
19 | > return (time, 0) | |
20 | > |
|
20 | > | |
21 | > util.getuser = mockgetuser |
|
21 | > util.getuser = mockgetuser | |
22 | > util.makedate = mockmakedate |
|
22 | > util.makedate = mockmakedate | |
23 | > EOF |
|
23 | > EOF | |
24 |
|
24 | |||
25 | $ cat >> $HGRCPATH << EOF |
|
25 | $ cat >> $HGRCPATH << EOF | |
26 | > [extensions] |
|
26 | > [extensions] | |
27 | > journal= |
|
27 | > journal= | |
28 | > share= |
|
28 | > share= | |
29 | > testmocks=`pwd`/testmocks.py |
|
29 | > testmocks=`pwd`/testmocks.py | |
30 | > [remotenames] |
|
30 | > [remotenames] | |
31 | > rename.default=remote |
|
31 | > rename.default=remote | |
32 | > EOF |
|
32 | > EOF | |
33 |
|
33 | |||
34 | $ hg init repo |
|
34 | $ hg init repo | |
35 | $ cd repo |
|
35 | $ cd repo | |
36 | $ hg bookmark bm |
|
36 | $ hg bookmark bm | |
37 | $ touch file0 |
|
37 | $ touch file0 | |
38 |
$ hg commit -Am |
|
38 | $ hg commit -Am file0-added | |
39 | adding file0 |
|
39 | adding file0 | |
40 | $ hg journal --all |
|
40 | $ hg journal --all | |
41 | previous locations of the working copy and bookmarks: |
|
41 | previous locations of the working copy and bookmarks: | |
42 |
|
|
42 | 0fd3805711f9 . commit -Am file0-added | |
43 |
|
|
43 | 0fd3805711f9 bm commit -Am file0-added | |
44 |
|
44 | |||
45 | A shared working copy initially receives the same bookmarks and working copy |
|
45 | A shared working copy initially receives the same bookmarks and working copy | |
46 |
|
46 | |||
47 | $ cd .. |
|
47 | $ cd .. | |
48 | $ hg share repo shared1 |
|
48 | $ hg share repo shared1 | |
49 | updating working directory |
|
49 | updating working directory | |
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
50 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
51 | $ cd shared1 |
|
51 | $ cd shared1 | |
52 | $ hg journal --all |
|
52 | $ hg journal --all | |
53 | previous locations of the working copy and bookmarks: |
|
53 | previous locations of the working copy and bookmarks: | |
54 |
|
|
54 | 0fd3805711f9 . share repo shared1 | |
55 |
|
55 | |||
56 | unless you explicitly share bookmarks |
|
56 | unless you explicitly share bookmarks | |
57 |
|
57 | |||
58 | $ cd .. |
|
58 | $ cd .. | |
59 | $ hg share --bookmarks repo shared2 |
|
59 | $ hg share --bookmarks repo shared2 | |
60 | updating working directory |
|
60 | updating working directory | |
61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
61 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
62 | $ cd shared2 |
|
62 | $ cd shared2 | |
63 | $ hg journal --all |
|
63 | $ hg journal --all | |
64 | previous locations of the working copy and bookmarks: |
|
64 | previous locations of the working copy and bookmarks: | |
65 |
|
|
65 | 0fd3805711f9 . share --bookmarks repo shared2 | |
66 |
|
|
66 | 0fd3805711f9 bm commit -Am file0-added | |
67 |
|
67 | |||
68 | Moving the bookmark in the original repository is only shown in the repository |
|
68 | Moving the bookmark in the original repository is only shown in the repository | |
69 | that shares bookmarks |
|
69 | that shares bookmarks | |
70 |
|
70 | |||
71 | $ cd ../repo |
|
71 | $ cd ../repo | |
72 | $ touch file1 |
|
72 | $ touch file1 | |
73 |
$ hg commit -Am |
|
73 | $ hg commit -Am file1-added | |
74 | adding file1 |
|
74 | adding file1 | |
75 | $ cd ../shared1 |
|
75 | $ cd ../shared1 | |
76 | $ hg journal --all |
|
76 | $ hg journal --all | |
77 | previous locations of the working copy and bookmarks: |
|
77 | previous locations of the working copy and bookmarks: | |
78 |
|
|
78 | 0fd3805711f9 . share repo shared1 | |
79 | $ cd ../shared2 |
|
79 | $ cd ../shared2 | |
80 | $ hg journal --all |
|
80 | $ hg journal --all | |
81 | previous locations of the working copy and bookmarks: |
|
81 | previous locations of the working copy and bookmarks: | |
82 |
|
|
82 | 4f354088b094 bm commit -Am file1-added | |
83 |
|
|
83 | 0fd3805711f9 . share --bookmarks repo shared2 | |
84 |
|
|
84 | 0fd3805711f9 bm commit -Am file0-added | |
85 |
|
85 | |||
86 | But working copy changes are always 'local' |
|
86 | But working copy changes are always 'local' | |
87 |
|
87 | |||
88 | $ cd ../repo |
|
88 | $ cd ../repo | |
89 | $ hg up 0 |
|
89 | $ hg up 0 | |
90 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
90 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
91 | (leaving bookmark bm) |
|
91 | (leaving bookmark bm) | |
92 | $ hg journal --all |
|
92 | $ hg journal --all | |
93 | previous locations of the working copy and bookmarks: |
|
93 | previous locations of the working copy and bookmarks: | |
94 |
|
|
94 | 0fd3805711f9 . up 0 | |
95 |
|
|
95 | 4f354088b094 . commit -Am file1-added | |
96 |
|
|
96 | 4f354088b094 bm commit -Am file1-added | |
97 |
|
|
97 | 0fd3805711f9 . commit -Am file0-added | |
98 |
|
|
98 | 0fd3805711f9 bm commit -Am file0-added | |
99 |
$ |
|
99 | $ cd ../shared2 | |
100 |
$ |
|
100 | $ hg journal --all | |
101 | previous locations of the working copy and bookmarks: |
|
101 | previous locations of the working copy and bookmarks: | |
102 |
|
|
102 | 4f354088b094 bm commit -Am file1-added | |
103 |
|
|
103 | 0fd3805711f9 . share --bookmarks repo shared2 | |
104 |
|
|
104 | 0fd3805711f9 bm commit -Am file0-added | |
105 |
$ |
|
105 | $ hg up tip | |
106 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
106 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
107 | $ hg up 0 |
|
107 | $ hg up 0 | |
108 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
108 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
109 | $ hg journal |
|
109 | $ hg journal | |
110 | previous locations of '.': |
|
110 | previous locations of '.': | |
111 | 5640b525682e up 0 |
|
111 | 0fd3805711f9 up 0 | |
112 | 6432d239ac5d up tip |
|
112 | 4f354088b094 up tip | |
113 |
|
|
113 | 0fd3805711f9 share --bookmarks repo shared2 | |
114 |
|
114 | |||
115 | Unsharing works as expected; the journal remains consistent |
|
115 | Unsharing works as expected; the journal remains consistent | |
116 |
|
116 | |||
117 | $ cd ../shared1 |
|
117 | $ cd ../shared1 | |
118 | $ hg unshare |
|
118 | $ hg unshare | |
119 | $ hg journal --all |
|
119 | $ hg journal --all | |
120 | previous locations of the working copy and bookmarks: |
|
120 | previous locations of the working copy and bookmarks: | |
121 |
|
|
121 | 0fd3805711f9 . share repo shared1 | |
122 | $ cd ../shared2 |
|
122 | $ cd ../shared2 | |
123 | $ hg unshare |
|
123 | $ hg unshare | |
124 | $ hg journal --all |
|
124 | $ hg journal --all | |
125 | previous locations of the working copy and bookmarks: |
|
125 | previous locations of the working copy and bookmarks: | |
126 |
|
|
126 | 0fd3805711f9 . up 0 | |
127 |
|
|
127 | 4f354088b094 . up tip | |
128 |
|
|
128 | 4f354088b094 bm commit -Am file1-added | |
129 |
|
|
129 | 0fd3805711f9 . share --bookmarks repo shared2 | |
130 |
|
|
130 | 0fd3805711f9 bm commit -Am file0-added | |
131 |
|
131 | |||
132 | New journal entries in the source repo no longer show up in the other working copies |
|
132 | New journal entries in the source repo no longer show up in the other working copies | |
133 |
|
133 | |||
134 | $ cd ../repo |
|
134 | $ cd ../repo | |
135 | $ hg bookmark newbm -r tip |
|
135 | $ hg bookmark newbm -r tip | |
136 | $ hg journal newbm |
|
136 | $ hg journal newbm | |
137 | previous locations of 'newbm': |
|
137 | previous locations of 'newbm': | |
138 |
|
|
138 | 4f354088b094 bookmark newbm -r tip | |
139 | $ cd ../shared2 |
|
139 | $ cd ../shared2 | |
140 | $ hg journal newbm |
|
140 | $ hg journal newbm | |
141 | previous locations of 'newbm': |
|
141 | previous locations of 'newbm': | |
142 | no recorded locations |
|
142 | no recorded locations | |
143 |
|
143 | |||
144 | This applies for both directions |
|
144 | This applies for both directions | |
145 |
|
145 | |||
146 | $ hg bookmark shared2bm -r tip |
|
146 | $ hg bookmark shared2bm -r tip | |
147 | $ hg journal shared2bm |
|
147 | $ hg journal shared2bm | |
148 | previous locations of 'shared2bm': |
|
148 | previous locations of 'shared2bm': | |
149 |
|
|
149 | 4f354088b094 bookmark shared2bm -r tip | |
150 | $ cd ../repo |
|
150 | $ cd ../repo | |
151 | $ hg journal shared2bm |
|
151 | $ hg journal shared2bm | |
152 | previous locations of 'shared2bm': |
|
152 | previous locations of 'shared2bm': | |
153 | no recorded locations |
|
153 | no recorded locations |
General Comments 0
You need to be logged in to leave comments.
Login now