Show More
@@ -1,213 +1,221 b'' | |||||
1 | # Mercurial bookmark support code |
|
1 | # Mercurial bookmark support code | |
2 | # |
|
2 | # | |
3 | # Copyright 2008 David Soria Parra <dsp@php.net> |
|
3 | # Copyright 2008 David Soria Parra <dsp@php.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from mercurial.i18n import _ |
|
8 | from mercurial.i18n import _ | |
9 | from mercurial.node import hex |
|
9 | from mercurial.node import hex | |
10 | from mercurial import encoding, error, util |
|
10 | from mercurial import encoding, error, util | |
11 | import errno, os |
|
11 | import errno, os | |
12 |
|
12 | |||
13 | def valid(mark): |
|
13 | def valid(mark): | |
14 | for c in (':', '\0', '\n', '\r'): |
|
14 | for c in (':', '\0', '\n', '\r'): | |
15 | if c in mark: |
|
15 | if c in mark: | |
16 | return False |
|
16 | return False | |
17 | return True |
|
17 | return True | |
18 |
|
18 | |||
19 | def read(repo): |
|
19 | def read(repo): | |
20 | '''Parse .hg/bookmarks file and return a dictionary |
|
20 | '''Parse .hg/bookmarks file and return a dictionary | |
21 |
|
21 | |||
22 | Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values |
|
22 | Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values | |
23 | in the .hg/bookmarks file. |
|
23 | in the .hg/bookmarks file. | |
24 | Read the file and return a (name=>nodeid) dictionary |
|
24 | Read the file and return a (name=>nodeid) dictionary | |
25 | ''' |
|
25 | ''' | |
26 | bookmarks = {} |
|
26 | bookmarks = {} | |
27 | try: |
|
27 | try: | |
28 | for line in repo.opener('bookmarks'): |
|
28 | for line in repo.opener('bookmarks'): | |
29 | line = line.strip() |
|
29 | line = line.strip() | |
30 | if not line: |
|
30 | if not line: | |
31 | continue |
|
31 | continue | |
32 | if ' ' not in line: |
|
32 | if ' ' not in line: | |
33 | repo.ui.warn(_('malformed line in .hg/bookmarks: %r\n') % line) |
|
33 | repo.ui.warn(_('malformed line in .hg/bookmarks: %r\n') % line) | |
34 | continue |
|
34 | continue | |
35 | sha, refspec = line.split(' ', 1) |
|
35 | sha, refspec = line.split(' ', 1) | |
36 | refspec = encoding.tolocal(refspec) |
|
36 | refspec = encoding.tolocal(refspec) | |
37 | try: |
|
37 | try: | |
38 | bookmarks[refspec] = repo.changelog.lookup(sha) |
|
38 | bookmarks[refspec] = repo.changelog.lookup(sha) | |
39 | except error.RepoLookupError: |
|
39 | except error.RepoLookupError: | |
40 | pass |
|
40 | pass | |
41 | except IOError, inst: |
|
41 | except IOError, inst: | |
42 | if inst.errno != errno.ENOENT: |
|
42 | if inst.errno != errno.ENOENT: | |
43 | raise |
|
43 | raise | |
44 | return bookmarks |
|
44 | return bookmarks | |
45 |
|
45 | |||
46 | def readcurrent(repo): |
|
46 | def readcurrent(repo): | |
47 | '''Get the current bookmark |
|
47 | '''Get the current bookmark | |
48 |
|
48 | |||
49 | If we use gittishsh branches we have a current bookmark that |
|
49 | If we use gittishsh branches we have a current bookmark that | |
50 | we are on. This function returns the name of the bookmark. It |
|
50 | we are on. This function returns the name of the bookmark. It | |
51 | is stored in .hg/bookmarks.current |
|
51 | is stored in .hg/bookmarks.current | |
52 | ''' |
|
52 | ''' | |
53 | mark = None |
|
53 | mark = None | |
54 | try: |
|
54 | try: | |
55 | file = repo.opener('bookmarks.current') |
|
55 | file = repo.opener('bookmarks.current') | |
56 | except IOError, inst: |
|
56 | except IOError, inst: | |
57 | if inst.errno != errno.ENOENT: |
|
57 | if inst.errno != errno.ENOENT: | |
58 | raise |
|
58 | raise | |
59 | return None |
|
59 | return None | |
60 | try: |
|
60 | try: | |
61 | # No readline() in posixfile_nt, reading everything is cheap |
|
61 | # No readline() in posixfile_nt, reading everything is cheap | |
62 | mark = encoding.tolocal((file.readlines() or [''])[0]) |
|
62 | mark = encoding.tolocal((file.readlines() or [''])[0]) | |
63 | if mark == '' or mark not in repo._bookmarks: |
|
63 | if mark == '' or mark not in repo._bookmarks: | |
64 | mark = None |
|
64 | mark = None | |
65 | finally: |
|
65 | finally: | |
66 | file.close() |
|
66 | file.close() | |
67 | return mark |
|
67 | return mark | |
68 |
|
68 | |||
69 | def write(repo): |
|
69 | def write(repo): | |
70 | '''Write bookmarks |
|
70 | '''Write bookmarks | |
71 |
|
71 | |||
72 | Write the given bookmark => hash dictionary to the .hg/bookmarks file |
|
72 | Write the given bookmark => hash dictionary to the .hg/bookmarks file | |
73 | in a format equal to those of localtags. |
|
73 | in a format equal to those of localtags. | |
74 |
|
74 | |||
75 | We also store a backup of the previous state in undo.bookmarks that |
|
75 | We also store a backup of the previous state in undo.bookmarks that | |
76 | can be copied back on rollback. |
|
76 | can be copied back on rollback. | |
77 | ''' |
|
77 | ''' | |
78 | refs = repo._bookmarks |
|
78 | refs = repo._bookmarks | |
79 |
|
79 | |||
80 | if repo._bookmarkcurrent not in refs: |
|
80 | if repo._bookmarkcurrent not in refs: | |
81 | setcurrent(repo, None) |
|
81 | setcurrent(repo, None) | |
82 | for mark in refs.keys(): |
|
82 | for mark in refs.keys(): | |
83 | if not valid(mark): |
|
83 | if not valid(mark): | |
84 | raise util.Abort(_("bookmark '%s' contains illegal " |
|
84 | raise util.Abort(_("bookmark '%s' contains illegal " | |
85 | "character" % mark)) |
|
85 | "character" % mark)) | |
86 |
|
86 | |||
87 | wlock = repo.wlock() |
|
87 | wlock = repo.wlock() | |
88 | try: |
|
88 | try: | |
89 |
|
89 | |||
90 | file = repo.opener('bookmarks', 'w', atomictemp=True) |
|
90 | file = repo.opener('bookmarks', 'w', atomictemp=True) | |
91 | for refspec, node in refs.iteritems(): |
|
91 | for refspec, node in refs.iteritems(): | |
92 | file.write("%s %s\n" % (hex(node), encoding.fromlocal(refspec))) |
|
92 | file.write("%s %s\n" % (hex(node), encoding.fromlocal(refspec))) | |
93 | file.close() |
|
93 | file.close() | |
94 |
|
94 | |||
95 | # touch 00changelog.i so hgweb reloads bookmarks (no lock needed) |
|
95 | # touch 00changelog.i so hgweb reloads bookmarks (no lock needed) | |
96 | try: |
|
96 | try: | |
97 | os.utime(repo.sjoin('00changelog.i'), None) |
|
97 | os.utime(repo.sjoin('00changelog.i'), None) | |
98 | except OSError: |
|
98 | except OSError: | |
99 | pass |
|
99 | pass | |
100 |
|
100 | |||
101 | finally: |
|
101 | finally: | |
102 | wlock.release() |
|
102 | wlock.release() | |
103 |
|
103 | |||
104 | def setcurrent(repo, mark): |
|
104 | def setcurrent(repo, mark): | |
105 | '''Set the name of the bookmark that we are currently on |
|
105 | '''Set the name of the bookmark that we are currently on | |
106 |
|
106 | |||
107 | Set the name of the bookmark that we are on (hg update <bookmark>). |
|
107 | Set the name of the bookmark that we are on (hg update <bookmark>). | |
108 | The name is recorded in .hg/bookmarks.current |
|
108 | The name is recorded in .hg/bookmarks.current | |
109 | ''' |
|
109 | ''' | |
110 | current = repo._bookmarkcurrent |
|
110 | current = repo._bookmarkcurrent | |
111 | if current == mark: |
|
111 | if current == mark: | |
112 | return |
|
112 | return | |
113 |
|
113 | |||
114 | if mark not in repo._bookmarks: |
|
114 | if mark not in repo._bookmarks: | |
115 | mark = '' |
|
115 | mark = '' | |
116 | if not valid(mark): |
|
116 | if not valid(mark): | |
117 | raise util.Abort(_("bookmark '%s' contains illegal " |
|
117 | raise util.Abort(_("bookmark '%s' contains illegal " | |
118 | "character" % mark)) |
|
118 | "character" % mark)) | |
119 |
|
119 | |||
120 | wlock = repo.wlock() |
|
120 | wlock = repo.wlock() | |
121 | try: |
|
121 | try: | |
122 | file = repo.opener('bookmarks.current', 'w', atomictemp=True) |
|
122 | file = repo.opener('bookmarks.current', 'w', atomictemp=True) | |
123 | file.write(encoding.fromlocal(mark)) |
|
123 | file.write(encoding.fromlocal(mark)) | |
124 | file.close() |
|
124 | file.close() | |
125 | finally: |
|
125 | finally: | |
126 | wlock.release() |
|
126 | wlock.release() | |
127 | repo._bookmarkcurrent = mark |
|
127 | repo._bookmarkcurrent = mark | |
128 |
|
128 | |||
129 | def updatecurrentbookmark(repo, oldnode, curbranch): |
|
129 | def updatecurrentbookmark(repo, oldnode, curbranch): | |
130 | try: |
|
130 | try: | |
131 | update(repo, oldnode, repo.branchtags()[curbranch]) |
|
131 | update(repo, oldnode, repo.branchtags()[curbranch]) | |
132 | except KeyError: |
|
132 | except KeyError: | |
133 | if curbranch == "default": # no default branch! |
|
133 | if curbranch == "default": # no default branch! | |
134 | update(repo, oldnode, repo.lookup("tip")) |
|
134 | update(repo, oldnode, repo.lookup("tip")) | |
135 | else: |
|
135 | else: | |
136 | raise util.Abort(_("branch %s not found") % curbranch) |
|
136 | raise util.Abort(_("branch %s not found") % curbranch) | |
137 |
|
137 | |||
138 | def update(repo, parents, node): |
|
138 | def update(repo, parents, node): | |
139 | marks = repo._bookmarks |
|
139 | marks = repo._bookmarks | |
140 | update = False |
|
140 | update = False | |
141 | mark = repo._bookmarkcurrent |
|
141 | mark = repo._bookmarkcurrent | |
142 | if mark and marks[mark] in parents: |
|
142 | if mark and marks[mark] in parents: | |
143 | old = repo[marks[mark]] |
|
143 | old = repo[marks[mark]] | |
144 | new = repo[node] |
|
144 | new = repo[node] | |
145 | if new in old.descendants(): |
|
145 | if new in old.descendants(): | |
146 | marks[mark] = new.node() |
|
146 | marks[mark] = new.node() | |
147 | update = True |
|
147 | update = True | |
148 | if update: |
|
148 | if update: | |
149 | repo._writebookmarks(marks) |
|
149 | repo._writebookmarks(marks) | |
150 |
|
150 | |||
151 | def listbookmarks(repo): |
|
151 | def listbookmarks(repo): | |
152 | # We may try to list bookmarks on a repo type that does not |
|
152 | # We may try to list bookmarks on a repo type that does not | |
153 | # support it (e.g., statichttprepository). |
|
153 | # support it (e.g., statichttprepository). | |
154 | marks = getattr(repo, '_bookmarks', {}) |
|
154 | marks = getattr(repo, '_bookmarks', {}) | |
155 |
|
155 | |||
156 | d = {} |
|
156 | d = {} | |
157 | for k, v in marks.iteritems(): |
|
157 | for k, v in marks.iteritems(): | |
158 | d[k] = hex(v) |
|
158 | # don't expose local divergent bookmarks | |
|
159 | if '@' not in k and not k.endswith('@'): | |||
|
160 | d[k] = hex(v) | |||
159 | return d |
|
161 | return d | |
160 |
|
162 | |||
161 | def pushbookmark(repo, key, old, new): |
|
163 | def pushbookmark(repo, key, old, new): | |
162 | w = repo.wlock() |
|
164 | w = repo.wlock() | |
163 | try: |
|
165 | try: | |
164 | marks = repo._bookmarks |
|
166 | marks = repo._bookmarks | |
165 | if hex(marks.get(key, '')) != old: |
|
167 | if hex(marks.get(key, '')) != old: | |
166 | return False |
|
168 | return False | |
167 | if new == '': |
|
169 | if new == '': | |
168 | del marks[key] |
|
170 | del marks[key] | |
169 | else: |
|
171 | else: | |
170 | if new not in repo: |
|
172 | if new not in repo: | |
171 | return False |
|
173 | return False | |
172 | marks[key] = repo[new].node() |
|
174 | marks[key] = repo[new].node() | |
173 | write(repo) |
|
175 | write(repo) | |
174 | return True |
|
176 | return True | |
175 | finally: |
|
177 | finally: | |
176 | w.release() |
|
178 | w.release() | |
177 |
|
179 | |||
178 | def updatefromremote(ui, repo, remote): |
|
180 | def updatefromremote(ui, repo, remote): | |
179 | ui.debug("checking for updated bookmarks\n") |
|
181 | ui.debug("checking for updated bookmarks\n") | |
180 | rb = remote.listkeys('bookmarks') |
|
182 | rb = remote.listkeys('bookmarks') | |
181 | changed = False |
|
183 | changed = False | |
182 | for k in rb.keys(): |
|
184 | for k in rb.keys(): | |
183 | if k in repo._bookmarks: |
|
185 | if k in repo._bookmarks: | |
184 | nr, nl = rb[k], repo._bookmarks[k] |
|
186 | nr, nl = rb[k], repo._bookmarks[k] | |
185 | if nr in repo: |
|
187 | if nr in repo: | |
186 | cr = repo[nr] |
|
188 | cr = repo[nr] | |
187 | cl = repo[nl] |
|
189 | cl = repo[nl] | |
188 | if cl.rev() >= cr.rev(): |
|
190 | if cl.rev() >= cr.rev(): | |
189 | continue |
|
191 | continue | |
190 | if cr in cl.descendants(): |
|
192 | if cr in cl.descendants(): | |
191 | repo._bookmarks[k] = cr.node() |
|
193 | repo._bookmarks[k] = cr.node() | |
192 | changed = True |
|
194 | changed = True | |
193 | ui.status(_("updating bookmark %s\n") % k) |
|
195 | ui.status(_("updating bookmark %s\n") % k) | |
194 | else: |
|
196 | else: | |
195 | ui.warn(_("not updating divergent" |
|
197 | for x in range(1, 100): | |
196 |
|
|
198 | n = '%s@%d' % (k, x) | |
|
199 | if n not in repo._bookmarks: | |||
|
200 | break | |||
|
201 | repo._bookmarks[n] = cr.node() | |||
|
202 | changed = True | |||
|
203 | ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n)) | |||
|
204 | ||||
197 | if changed: |
|
205 | if changed: | |
198 | write(repo) |
|
206 | write(repo) | |
199 |
|
207 | |||
200 | def diff(ui, repo, remote): |
|
208 | def diff(ui, repo, remote): | |
201 | ui.status(_("searching for changed bookmarks\n")) |
|
209 | ui.status(_("searching for changed bookmarks\n")) | |
202 |
|
210 | |||
203 | lmarks = repo.listkeys('bookmarks') |
|
211 | lmarks = repo.listkeys('bookmarks') | |
204 | rmarks = remote.listkeys('bookmarks') |
|
212 | rmarks = remote.listkeys('bookmarks') | |
205 |
|
213 | |||
206 | diff = sorted(set(rmarks) - set(lmarks)) |
|
214 | diff = sorted(set(rmarks) - set(lmarks)) | |
207 | for k in diff: |
|
215 | for k in diff: | |
208 | ui.write(" %-25s %s\n" % (k, rmarks[k][:12])) |
|
216 | ui.write(" %-25s %s\n" % (k, rmarks[k][:12])) | |
209 |
|
217 | |||
210 | if len(diff) <= 0: |
|
218 | if len(diff) <= 0: | |
211 | ui.status(_("no changed bookmarks found\n")) |
|
219 | ui.status(_("no changed bookmarks found\n")) | |
212 | return 1 |
|
220 | return 1 | |
213 | return 0 |
|
221 | return 0 |
@@ -1,195 +1,196 b'' | |||||
1 | $ "$TESTDIR/hghave" serve || exit 80 |
|
1 | $ "$TESTDIR/hghave" serve || exit 80 | |
2 |
|
2 | |||
3 | initialize |
|
3 | initialize | |
4 |
|
4 | |||
5 | $ hg init a |
|
5 | $ hg init a | |
6 | $ cd a |
|
6 | $ cd a | |
7 | $ echo 'test' > test |
|
7 | $ echo 'test' > test | |
8 | $ hg commit -Am'test' |
|
8 | $ hg commit -Am'test' | |
9 | adding test |
|
9 | adding test | |
10 |
|
10 | |||
11 | set bookmarks |
|
11 | set bookmarks | |
12 |
|
12 | |||
13 | $ hg bookmark X |
|
13 | $ hg bookmark X | |
14 | $ hg bookmark Y |
|
14 | $ hg bookmark Y | |
15 | $ hg bookmark Z |
|
15 | $ hg bookmark Z | |
16 |
|
16 | |||
17 | import bookmark by name |
|
17 | import bookmark by name | |
18 |
|
18 | |||
19 | $ hg init ../b |
|
19 | $ hg init ../b | |
20 | $ cd ../b |
|
20 | $ cd ../b | |
21 | $ hg book Y |
|
21 | $ hg book Y | |
22 | $ hg book |
|
22 | $ hg book | |
23 | * Y -1:000000000000 |
|
23 | * Y -1:000000000000 | |
24 | $ hg pull ../a |
|
24 | $ hg pull ../a | |
25 | pulling from ../a |
|
25 | pulling from ../a | |
26 | requesting all changes |
|
26 | requesting all changes | |
27 | adding changesets |
|
27 | adding changesets | |
28 | adding manifests |
|
28 | adding manifests | |
29 | adding file changes |
|
29 | adding file changes | |
30 | added 1 changesets with 1 changes to 1 files |
|
30 | added 1 changesets with 1 changes to 1 files | |
31 | updating bookmark Y |
|
31 | updating bookmark Y | |
32 | (run 'hg update' to get a working copy) |
|
32 | (run 'hg update' to get a working copy) | |
33 | $ hg bookmarks |
|
33 | $ hg bookmarks | |
34 | Y 0:4e3505fd9583 |
|
34 | Y 0:4e3505fd9583 | |
35 | $ hg debugpushkey ../a namespaces |
|
35 | $ hg debugpushkey ../a namespaces | |
36 | bookmarks |
|
36 | bookmarks | |
37 | namespaces |
|
37 | namespaces | |
38 | $ hg debugpushkey ../a bookmarks |
|
38 | $ hg debugpushkey ../a bookmarks | |
39 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
39 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
40 | X 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
40 | X 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
41 | Z 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
41 | Z 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
42 | $ hg pull -B X ../a |
|
42 | $ hg pull -B X ../a | |
43 | pulling from ../a |
|
43 | pulling from ../a | |
44 | no changes found |
|
44 | no changes found | |
45 | importing bookmark X |
|
45 | importing bookmark X | |
46 | $ hg bookmark |
|
46 | $ hg bookmark | |
47 | X 0:4e3505fd9583 |
|
47 | X 0:4e3505fd9583 | |
48 | Y 0:4e3505fd9583 |
|
48 | Y 0:4e3505fd9583 | |
49 |
|
49 | |||
50 | export bookmark by name |
|
50 | export bookmark by name | |
51 |
|
51 | |||
52 | $ hg bookmark W |
|
52 | $ hg bookmark W | |
53 | $ hg bookmark foo |
|
53 | $ hg bookmark foo | |
54 | $ hg bookmark foobar |
|
54 | $ hg bookmark foobar | |
55 | $ hg push -B W ../a |
|
55 | $ hg push -B W ../a | |
56 | pushing to ../a |
|
56 | pushing to ../a | |
57 | searching for changes |
|
57 | searching for changes | |
58 | no changes found |
|
58 | no changes found | |
59 | exporting bookmark W |
|
59 | exporting bookmark W | |
60 | $ hg -R ../a bookmarks |
|
60 | $ hg -R ../a bookmarks | |
61 | W -1:000000000000 |
|
61 | W -1:000000000000 | |
62 | X 0:4e3505fd9583 |
|
62 | X 0:4e3505fd9583 | |
63 | Y 0:4e3505fd9583 |
|
63 | Y 0:4e3505fd9583 | |
64 | * Z 0:4e3505fd9583 |
|
64 | * Z 0:4e3505fd9583 | |
65 |
|
65 | |||
66 | delete a remote bookmark |
|
66 | delete a remote bookmark | |
67 |
|
67 | |||
68 | $ hg book -d W |
|
68 | $ hg book -d W | |
69 | $ hg push -B W ../a |
|
69 | $ hg push -B W ../a | |
70 | pushing to ../a |
|
70 | pushing to ../a | |
71 | searching for changes |
|
71 | searching for changes | |
72 | no changes found |
|
72 | no changes found | |
73 | deleting remote bookmark W |
|
73 | deleting remote bookmark W | |
74 |
|
74 | |||
75 | push/pull name that doesn't exist |
|
75 | push/pull name that doesn't exist | |
76 |
|
76 | |||
77 | $ hg push -B badname ../a |
|
77 | $ hg push -B badname ../a | |
78 | pushing to ../a |
|
78 | pushing to ../a | |
79 | searching for changes |
|
79 | searching for changes | |
80 | no changes found |
|
80 | no changes found | |
81 | bookmark badname does not exist on the local or remote repository! |
|
81 | bookmark badname does not exist on the local or remote repository! | |
82 | [2] |
|
82 | [2] | |
83 | $ hg pull -B anotherbadname ../a |
|
83 | $ hg pull -B anotherbadname ../a | |
84 | pulling from ../a |
|
84 | pulling from ../a | |
85 | abort: remote bookmark anotherbadname not found! |
|
85 | abort: remote bookmark anotherbadname not found! | |
86 | [255] |
|
86 | [255] | |
87 |
|
87 | |||
88 | divergent bookmarks |
|
88 | divergent bookmarks | |
89 |
|
89 | |||
90 | $ cd ../a |
|
90 | $ cd ../a | |
91 | $ echo c1 > f1 |
|
91 | $ echo c1 > f1 | |
92 | $ hg ci -Am1 |
|
92 | $ hg ci -Am1 | |
93 | adding f1 |
|
93 | adding f1 | |
94 | $ hg book -f X |
|
94 | $ hg book -f X | |
95 | $ hg book |
|
95 | $ hg book | |
96 | * X 1:0d2164f0ce0d |
|
96 | * X 1:0d2164f0ce0d | |
97 | Y 0:4e3505fd9583 |
|
97 | Y 0:4e3505fd9583 | |
98 | Z 1:0d2164f0ce0d |
|
98 | Z 1:0d2164f0ce0d | |
99 |
|
99 | |||
100 | $ cd ../b |
|
100 | $ cd ../b | |
101 | $ hg up |
|
101 | $ hg up | |
102 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
102 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
103 | $ echo c2 > f2 |
|
103 | $ echo c2 > f2 | |
104 | $ hg ci -Am2 |
|
104 | $ hg ci -Am2 | |
105 | adding f2 |
|
105 | adding f2 | |
106 | $ hg book -f X |
|
106 | $ hg book -f X | |
107 | $ hg book |
|
107 | $ hg book | |
108 | * X 1:9b140be10808 |
|
108 | * X 1:9b140be10808 | |
109 | Y 0:4e3505fd9583 |
|
109 | Y 0:4e3505fd9583 | |
110 | foo -1:000000000000 |
|
110 | foo -1:000000000000 | |
111 | foobar -1:000000000000 |
|
111 | foobar -1:000000000000 | |
112 |
|
112 | |||
113 | $ hg pull ../a |
|
113 | $ hg pull ../a | |
114 | pulling from ../a |
|
114 | pulling from ../a | |
115 | searching for changes |
|
115 | searching for changes | |
116 | adding changesets |
|
116 | adding changesets | |
117 | adding manifests |
|
117 | adding manifests | |
118 | adding file changes |
|
118 | adding file changes | |
119 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
119 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
120 |
|
|
120 | divergent bookmark X stored as X@1 | |
121 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
121 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
122 | $ hg book |
|
122 | $ hg book | |
123 | * X 1:9b140be10808 |
|
123 | * X 1:9b140be10808 | |
|
124 | X@1 2:0d2164f0ce0d | |||
124 | Y 0:4e3505fd9583 |
|
125 | Y 0:4e3505fd9583 | |
125 | foo -1:000000000000 |
|
126 | foo -1:000000000000 | |
126 | foobar -1:000000000000 |
|
127 | foobar -1:000000000000 | |
127 | $ hg push -f ../a |
|
128 | $ hg push -f ../a | |
128 | pushing to ../a |
|
129 | pushing to ../a | |
129 | searching for changes |
|
130 | searching for changes | |
130 | adding changesets |
|
131 | adding changesets | |
131 | adding manifests |
|
132 | adding manifests | |
132 | adding file changes |
|
133 | adding file changes | |
133 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
134 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
134 | $ hg -R ../a book |
|
135 | $ hg -R ../a book | |
135 | * X 1:0d2164f0ce0d |
|
136 | * X 1:0d2164f0ce0d | |
136 | Y 0:4e3505fd9583 |
|
137 | Y 0:4e3505fd9583 | |
137 | Z 1:0d2164f0ce0d |
|
138 | Z 1:0d2164f0ce0d | |
138 |
|
139 | |||
139 | hgweb |
|
140 | hgweb | |
140 |
|
141 | |||
141 | $ cat <<EOF > .hg/hgrc |
|
142 | $ cat <<EOF > .hg/hgrc | |
142 | > [web] |
|
143 | > [web] | |
143 | > push_ssl = false |
|
144 | > push_ssl = false | |
144 | > allow_push = * |
|
145 | > allow_push = * | |
145 | > EOF |
|
146 | > EOF | |
146 |
|
147 | |||
147 | $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log |
|
148 | $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log | |
148 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
149 | $ cat ../hg.pid >> $DAEMON_PIDS | |
149 | $ cd ../a |
|
150 | $ cd ../a | |
150 |
|
151 | |||
151 | $ hg debugpushkey http://localhost:$HGPORT/ namespaces |
|
152 | $ hg debugpushkey http://localhost:$HGPORT/ namespaces | |
152 | bookmarks |
|
153 | bookmarks | |
153 | namespaces |
|
154 | namespaces | |
154 | $ hg debugpushkey http://localhost:$HGPORT/ bookmarks |
|
155 | $ hg debugpushkey http://localhost:$HGPORT/ bookmarks | |
155 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 |
|
156 | Y 4e3505fd95835d721066b76e75dbb8cc554d7f77 | |
156 | X 9b140be1080824d768c5a4691a564088eede71f9 |
|
157 | X 9b140be1080824d768c5a4691a564088eede71f9 | |
157 | foo 0000000000000000000000000000000000000000 |
|
158 | foo 0000000000000000000000000000000000000000 | |
158 | foobar 0000000000000000000000000000000000000000 |
|
159 | foobar 0000000000000000000000000000000000000000 | |
159 | $ hg out -B http://localhost:$HGPORT/ |
|
160 | $ hg out -B http://localhost:$HGPORT/ | |
160 | comparing with http://localhost:$HGPORT/ |
|
161 | comparing with http://localhost:$HGPORT/ | |
161 | searching for changed bookmarks |
|
162 | searching for changed bookmarks | |
162 | Z 0d2164f0ce0d |
|
163 | Z 0d2164f0ce0d | |
163 | $ hg push -B Z http://localhost:$HGPORT/ |
|
164 | $ hg push -B Z http://localhost:$HGPORT/ | |
164 | pushing to http://localhost:$HGPORT/ |
|
165 | pushing to http://localhost:$HGPORT/ | |
165 | searching for changes |
|
166 | searching for changes | |
166 | no changes found |
|
167 | no changes found | |
167 | exporting bookmark Z |
|
168 | exporting bookmark Z | |
168 | $ hg book -d Z |
|
169 | $ hg book -d Z | |
169 | $ hg in -B http://localhost:$HGPORT/ |
|
170 | $ hg in -B http://localhost:$HGPORT/ | |
170 | comparing with http://localhost:$HGPORT/ |
|
171 | comparing with http://localhost:$HGPORT/ | |
171 | searching for changed bookmarks |
|
172 | searching for changed bookmarks | |
172 | Z 0d2164f0ce0d |
|
173 | Z 0d2164f0ce0d | |
173 | foo 000000000000 |
|
174 | foo 000000000000 | |
174 | foobar 000000000000 |
|
175 | foobar 000000000000 | |
175 | $ hg pull -B Z http://localhost:$HGPORT/ |
|
176 | $ hg pull -B Z http://localhost:$HGPORT/ | |
176 | pulling from http://localhost:$HGPORT/ |
|
177 | pulling from http://localhost:$HGPORT/ | |
177 | no changes found |
|
178 | no changes found | |
178 |
|
|
179 | divergent bookmark X stored as X@1 | |
179 | importing bookmark Z |
|
180 | importing bookmark Z | |
180 | $ hg clone http://localhost:$HGPORT/ cloned-bookmarks |
|
181 | $ hg clone http://localhost:$HGPORT/ cloned-bookmarks | |
181 | requesting all changes |
|
182 | requesting all changes | |
182 | adding changesets |
|
183 | adding changesets | |
183 | adding manifests |
|
184 | adding manifests | |
184 | adding file changes |
|
185 | adding file changes | |
185 | added 3 changesets with 3 changes to 3 files (+1 heads) |
|
186 | added 3 changesets with 3 changes to 3 files (+1 heads) | |
186 | updating to branch default |
|
187 | updating to branch default | |
187 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
188 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
188 | $ hg -R cloned-bookmarks bookmarks |
|
189 | $ hg -R cloned-bookmarks bookmarks | |
189 | X 1:9b140be10808 |
|
190 | X 1:9b140be10808 | |
190 | Y 0:4e3505fd9583 |
|
191 | Y 0:4e3505fd9583 | |
191 | Z 2:0d2164f0ce0d |
|
192 | Z 2:0d2164f0ce0d | |
192 | foo -1:000000000000 |
|
193 | foo -1:000000000000 | |
193 | foobar -1:000000000000 |
|
194 | foobar -1:000000000000 | |
194 |
|
195 | |||
195 | $ kill `cat ../hg.pid` |
|
196 | $ kill `cat ../hg.pid` |
General Comments 0
You need to be logged in to leave comments.
Login now