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