Show More
@@ -7,6 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | from node import hex |
|
9 | from node import hex | |
|
10 | import cmdutil | |||
10 | import util |
|
11 | import util | |
11 | import cStringIO, os, stat, tarfile, time, zipfile |
|
12 | import cStringIO, os, stat, tarfile, time, zipfile | |
12 | import zlib, gzip |
|
13 | import zlib, gzip | |
@@ -217,9 +218,25 b' def archive(repo, dest, node, kind, deco' | |||||
217 | archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0]) |
|
218 | archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0]) | |
218 |
|
219 | |||
219 | if repo.ui.configbool("ui", "archivemeta", True): |
|
220 | if repo.ui.configbool("ui", "archivemeta", True): | |
220 | write('.hg_archival.txt', 0644, False, |
|
221 | def metadata(): | |
221 |
|
|
222 | base = 'repo: %s\nnode: %s\nbranch: %s\n' % ( | |
222 |
|
|
223 | hex(repo.changelog.node(0)), hex(node), ctx.branch()) | |
|
224 | ||||
|
225 | tags = ''.join('tag: %s\n' % t for t in ctx.tags() | |||
|
226 | if repo.tagtype(t) == 'global') | |||
|
227 | if not tags: | |||
|
228 | repo.ui.pushbuffer() | |||
|
229 | opts = {'template': '{latesttag}\n{latesttagdistance}', | |||
|
230 | 'style': '', 'patch': None, 'git': None} | |||
|
231 | cmdutil.show_changeset(repo.ui, repo, opts).show(ctx) | |||
|
232 | ltags, dist = repo.ui.popbuffer().split('\n') | |||
|
233 | tags = ''.join('latesttag: %s\n' % t for t in ltags.split(':')) | |||
|
234 | tags += 'latesttagdistance: %s\n' % dist | |||
|
235 | ||||
|
236 | return base + tags | |||
|
237 | ||||
|
238 | write('.hg_archival.txt', 0644, False, metadata) | |||
|
239 | ||||
223 | for f in ctx: |
|
240 | for f in ctx: | |
224 | ff = ctx.flags(f) |
|
241 | ff = ctx.flags(f) | |
225 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
|
242 | write(f, 'x' in ff and 0755 or 0644, 'l' in ff, ctx[f].data) |
@@ -108,6 +108,14 b' if [ -f rev-0.tar ]; then' | |||||
108 | echo 'rev-0.tar created' |
|
108 | echo 'rev-0.tar created' | |
109 | fi |
|
109 | fi | |
110 |
|
110 | |||
|
111 | echo '% test .hg_archival.txt' | |||
|
112 | hg archive ../test-tags | |||
|
113 | cat ../test-tags/.hg_archival.txt | |||
|
114 | hg tag -r 2 mytag | |||
|
115 | hg tag -r 2 anothertag | |||
|
116 | hg archive -r 2 ../test-lasttag | |||
|
117 | cat ../test-lasttag/.hg_archival.txt | |||
|
118 | ||||
111 | hg archive -t bogus test.bogus |
|
119 | hg archive -t bogus test.bogus | |
112 |
|
120 | |||
113 | echo % server errors |
|
121 | echo % server errors |
@@ -57,6 +57,17 b' test-TIP/bar' | |||||
57 | test-TIP/baz/bletch |
|
57 | test-TIP/baz/bletch | |
58 | test-TIP/foo |
|
58 | test-TIP/foo | |
59 | rev-0.tar created |
|
59 | rev-0.tar created | |
|
60 | % test .hg_archival.txt | |||
|
61 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 | |||
|
62 | node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e | |||
|
63 | branch: default | |||
|
64 | latesttag: null | |||
|
65 | latesttagdistance: 3 | |||
|
66 | repo: daa7f7c60e0a224faa4ff77ca41b2760562af264 | |||
|
67 | node: 2c0277f05ed49d1c8328fb9ba92fba7a5ebcb33e | |||
|
68 | branch: default | |||
|
69 | tag: anothertag | |||
|
70 | tag: mytag | |||
60 | abort: unknown archive type 'bogus' |
|
71 | abort: unknown archive type 'bogus' | |
61 | % server errors |
|
72 | % server errors | |
62 | % empty repo |
|
73 | % empty repo |
General Comments 0
You need to be logged in to leave comments.
Login now