Show More
@@ -1,10 +1,7 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 | # |
|
2 | # | |
3 |
# This is an example of using HGEDITOR to |
|
3 | # This is an example of using HGEDITOR to create of diff to review the | |
4 | # commits and so on. |
|
4 | # changes while commiting. | |
5 |
|
||||
6 | # change this to one to turn on GPG support |
|
|||
7 | SIGN=0 |
|
|||
8 |
|
5 | |||
9 | # If you want to pass your favourite editor some other parameters |
|
6 | # If you want to pass your favourite editor some other parameters | |
10 | # only for Mercurial, modify this: |
|
7 | # only for Mercurial, modify this: | |
@@ -43,12 +40,7 b' HGTMP="${TMPDIR-/tmp}/hgeditor.$RANDOM.$' | |||||
43 | done |
|
40 | done | |
44 | ) |
|
41 | ) | |
45 |
|
42 | |||
46 |
|
|
43 | cat "$1" > "$HGTMP/msg" | |
47 | if [ "$SIGN" == "1" ]; then |
|
|||
48 | MANIFEST=`grep '^HG: manifest hash' "$1" | cut -b 19-` |
|
|||
49 | echo -e "\nmanifest hash: $MANIFEST" >> "$HGTMP/msg" |
|
|||
50 | fi |
|
|||
51 | grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$HGTMP/msg" |
|
|||
52 |
|
44 | |||
53 | CHECKSUM=`md5sum "$HGTMP/msg"` |
|
45 | CHECKSUM=`md5sum "$HGTMP/msg"` | |
54 | if [ -s "$HGTMP/diff" ]; then |
|
46 | if [ -s "$HGTMP/diff" ]; then | |
@@ -58,14 +50,6 b' else' | |||||
58 | fi |
|
50 | fi | |
59 | echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13 |
|
51 | echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13 | |
60 |
|
52 | |||
61 | if [ "$SIGN" == "1" ]; then |
|
53 | mv "$HGTMP/msg" "$1" | |
62 | { |
|
|||
63 | head -n 1 "$HGTMP/msg" |
|
|||
64 | echo |
|
|||
65 | grep -v "^HG:" "$HGTMP/msg" | gpg -t -a -u "${HGUSER}" --clearsign |
|
|||
66 | } > "$HGTMP/msg.gpg" && mv "$HGTMP/msg.gpg" "$1" |
|
|||
67 | else |
|
|||
68 | mv "$HGTMP/msg" "$1" |
|
|||
69 | fi |
|
|||
70 |
|
54 | |||
71 | exit $? |
|
55 | exit $? |
@@ -463,7 +463,8 b' def help_(ui, cmd=None, with_version=Fal' | |||||
463 | opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, |
|
463 | opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, | |
464 | longopt and " --%s" % longopt), |
|
464 | longopt and " --%s" % longopt), | |
465 | "%s%s" % (desc, |
|
465 | "%s%s" % (desc, | |
466 |
default |
|
466 | default | |
|
467 | and _(" (default: %s)") % default | |||
467 | or ""))) |
|
468 | or ""))) | |
468 |
|
469 | |||
469 | if opt_output: |
|
470 | if opt_output: | |
@@ -730,7 +731,8 b' def clone(ui, source, dest=None, **opts)' | |||||
730 | revs = None |
|
731 | revs = None | |
731 | if opts['rev']: |
|
732 | if opts['rev']: | |
732 | if not other.local(): |
|
733 | if not other.local(): | |
733 |
|
|
734 | error = "clone -r not supported yet for remote repositories." | |
|
735 | raise util.Abort(error) | |||
734 | else: |
|
736 | else: | |
735 | revs = [other.lookup(rev) for rev in opts['rev']] |
|
737 | revs = [other.lookup(rev) for rev in opts['rev']] | |
736 | repo = hg.repository(ui, dest, create=1) |
|
738 | repo = hg.repository(ui, dest, create=1) | |
@@ -985,7 +987,8 b' def debugcheckstate(ui, repo):' | |||||
985 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
987 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) | |
986 | errors += 1 |
|
988 | errors += 1 | |
987 | if errors: |
|
989 | if errors: | |
988 |
|
|
990 | error = _(".hg/dirstate inconsistent with current parent's manifest") | |
|
991 | raise util.Abort(error) | |||
989 |
|
992 | |||
990 | def debugconfig(ui): |
|
993 | def debugconfig(ui): | |
991 | """show combined config settings from all hgrc files""" |
|
994 | """show combined config settings from all hgrc files""" | |
@@ -1176,7 +1179,8 b' def export(ui, repo, *changesets, **opts' | |||||
1176 | revs = list(revrange(ui, repo, changesets)) |
|
1179 | revs = list(revrange(ui, repo, changesets)) | |
1177 | total = len(revs) |
|
1180 | total = len(revs) | |
1178 | revwidth = max(map(len, revs)) |
|
1181 | revwidth = max(map(len, revs)) | |
1179 |
|
|
1182 | msg = len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n") | |
|
1183 | ui.note(msg) | |||
1180 | for cset in revs: |
|
1184 | for cset in revs: | |
1181 | seqno += 1 |
|
1185 | seqno += 1 | |
1182 | doexport(ui, repo, cset, seqno, total, revwidth, opts) |
|
1186 | doexport(ui, repo, cset, seqno, total, revwidth, opts) | |
@@ -2019,7 +2023,7 b' def status(ui, repo, *pats, **opts):' | |||||
2019 | for f in changes: |
|
2023 | for f in changes: | |
2020 | ui.write(format % f) |
|
2024 | ui.write(format % f) | |
2021 |
|
2025 | |||
2022 | def tag(ui, repo, name, rev=None, **opts): |
|
2026 | def tag(ui, repo, name, rev_=None, **opts): | |
2023 | """add a tag for the current tip or a given revision |
|
2027 | """add a tag for the current tip or a given revision | |
2024 |
|
2028 | |||
2025 | Name a particular revision using <name>. |
|
2029 | Name a particular revision using <name>. | |
@@ -2037,10 +2041,10 b' def tag(ui, repo, name, rev=None, **opts' | |||||
2037 | """ |
|
2041 | """ | |
2038 | if name == "tip": |
|
2042 | if name == "tip": | |
2039 | raise util.Abort(_("the name 'tip' is reserved")) |
|
2043 | raise util.Abort(_("the name 'tip' is reserved")) | |
2040 |
if 'rev' |
|
2044 | if opts['rev']: | |
2041 | rev = opts['rev'] |
|
2045 | rev_ = opts['rev'] | |
2042 | if rev: |
|
2046 | if rev_: | |
2043 | r = hex(repo.lookup(rev)) |
|
2047 | r = hex(repo.lookup(rev_)) | |
2044 | else: |
|
2048 | else: | |
2045 | r = hex(repo.changelog.tip()) |
|
2049 | r = hex(repo.changelog.tip()) | |
2046 |
|
2050 | |||
@@ -2095,7 +2099,7 b' def tip(ui, repo):' | |||||
2095 | n = repo.changelog.tip() |
|
2099 | n = repo.changelog.tip() | |
2096 | show_changeset(ui, repo, changenode=n) |
|
2100 | show_changeset(ui, repo, changenode=n) | |
2097 |
|
2101 | |||
2098 | def unbundle(ui, repo, fname): |
|
2102 | def unbundle(ui, repo, fname, **opts): | |
2099 | """apply a changegroup file |
|
2103 | """apply a changegroup file | |
2100 |
|
2104 | |||
2101 | Apply a compressed changegroup file generated by the bundle |
|
2105 | Apply a compressed changegroup file generated by the bundle | |
@@ -2112,7 +2116,13 b' def unbundle(ui, repo, fname):' | |||||
2112 | yield zd.decompress(chunk) |
|
2116 | yield zd.decompress(chunk) | |
2113 |
|
2117 | |||
2114 | bzgen = bzgenerator(util.filechunkiter(f, 4096)) |
|
2118 | bzgen = bzgenerator(util.filechunkiter(f, 4096)) | |
2115 | repo.addchangegroup(util.chunkbuffer(bzgen)) |
|
2119 | if repo.addchangegroup(util.chunkbuffer(bzgen)): | |
|
2120 | return 1 | |||
|
2121 | ||||
|
2122 | if opts['update']: | |||
|
2123 | return update(ui, repo) | |||
|
2124 | else: | |||
|
2125 | ui.status(_("(run 'hg update' to get a working copy)\n")) | |||
2116 |
|
2126 | |||
2117 | def undo(ui, repo): |
|
2127 | def undo(ui, repo): | |
2118 | """undo the last commit or pull |
|
2128 | """undo the last commit or pull | |
@@ -2221,8 +2231,10 b' table = {' | |||||
2221 | [('U', 'noupdate', None, _('do not update the new working directory')), |
|
2231 | [('U', 'noupdate', None, _('do not update the new working directory')), | |
2222 | ('e', 'ssh', "", _('specify ssh command to use')), |
|
2232 | ('e', 'ssh', "", _('specify ssh command to use')), | |
2223 | ('', 'pull', None, _('use pull protocol to copy metadata')), |
|
2233 | ('', 'pull', None, _('use pull protocol to copy metadata')), | |
2224 | ('r', 'rev', [], _('a changeset you would like to have after cloning')), |
|
2234 | ('r', 'rev', [], | |
2225 | ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
|
2235 | _('a changeset you would like to have after cloning')), | |
|
2236 | ('', 'remotecmd', "", | |||
|
2237 | _('specify hg command to run on the remote side'))], | |||
2226 | _('hg clone [OPTION]... SOURCE [DEST]')), |
|
2238 | _('hg clone [OPTION]... SOURCE [DEST]')), | |
2227 | "^commit|ci": |
|
2239 | "^commit|ci": | |
2228 | (commit, |
|
2240 | (commit, | |
@@ -2235,10 +2247,14 b' table = {' | |||||
2235 | ('u', 'user', "", _('record user as commiter'))], |
|
2247 | ('u', 'user', "", _('record user as commiter'))], | |
2236 | _('hg commit [OPTION]... [FILE]...')), |
|
2248 | _('hg commit [OPTION]... [FILE]...')), | |
2237 | "copy|cp": (copy, |
|
2249 | "copy|cp": (copy, | |
2238 | [('I', 'include', [], _('include names matching the given patterns')), |
|
2250 | [('I', 'include', [], | |
2239 |
|
|
2251 | _('include names matching the given patterns')), | |
2240 | ('A', 'after', None, _('record a copy that has already occurred')), |
|
2252 | ('X', 'exclude', [], | |
2241 | ('f', 'force', None, _('forcibly copy over an existing managed file'))], |
|
2253 | _('exclude names matching the given patterns')), | |
|
2254 | ('A', 'after', None, | |||
|
2255 | _('record a copy that has already occurred')), | |||
|
2256 | ('f', 'force', None, | |||
|
2257 | _('forcibly copy over an existing managed file'))], | |||
2242 | _('hg copy [OPTION]... [SOURCE]... DEST')), |
|
2258 | _('hg copy [OPTION]... [SOURCE]... DEST')), | |
2243 | "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
|
2259 | "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), | |
2244 | "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
|
2260 | "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | |
@@ -2279,7 +2295,8 b' table = {' | |||||
2279 | ('X', 'exclude', [], _('exclude names matching the given patterns')), |
|
2295 | ('X', 'exclude', [], _('exclude names matching the given patterns')), | |
2280 | ('', 'all', None, _('print all revisions that match')), |
|
2296 | ('', 'all', None, _('print all revisions that match')), | |
2281 | ('i', 'ignore-case', None, _('ignore case when matching')), |
|
2297 | ('i', 'ignore-case', None, _('ignore case when matching')), | |
2282 |
('l', 'files-with-matches', None, |
|
2298 | ('l', 'files-with-matches', None, | |
|
2299 | _('print only filenames and revs that match')), | |||
2283 | ('n', 'line-number', None, _('print matching line numbers')), |
|
2300 | ('n', 'line-number', None, _('print matching line numbers')), | |
2284 | ('r', 'rev', [], _('search in given revision range')), |
|
2301 | ('r', 'rev', [], _('search in given revision range')), | |
2285 | ('u', 'user', None, _('print user who committed change'))], |
|
2302 | ('u', 'user', None, _('print user who committed change'))], | |
@@ -2293,9 +2310,11 b' table = {' | |||||
2293 | "identify|id": (identify, [], _('hg identify')), |
|
2310 | "identify|id": (identify, [], _('hg identify')), | |
2294 | "import|patch": |
|
2311 | "import|patch": | |
2295 | (import_, |
|
2312 | (import_, | |
2296 | [('p', 'strip', 1, _('directory strip option for patch. This has the same\n') + |
|
2313 | [('p', 'strip', 1, | |
2297 | _('meaning as the corresponding patch option')), |
|
2314 | _('directory strip option for patch. This has the same\n') + | |
2298 | ('f', 'force', None, _('skip check for outstanding uncommitted changes')), |
|
2315 | _('meaning as the corresponding patch option')), | |
|
2316 | ('f', 'force', None, | |||
|
2317 | _('skip check for outstanding uncommitted changes')), | |||
2299 | ('b', 'base', "", _('base path'))], |
|
2318 | ('b', 'base', "", _('base path'))], | |
2300 | "hg import [-f] [-p NUM] [-b BASE] PATCH..."), |
|
2319 | "hg import [-f] [-p NUM] [-b BASE] PATCH..."), | |
2301 | "incoming|in": (incoming, |
|
2320 | "incoming|in": (incoming, | |
@@ -2307,8 +2326,10 b' table = {' | |||||
2307 | "locate": |
|
2326 | "locate": | |
2308 | (locate, |
|
2327 | (locate, | |
2309 | [('r', 'rev', '', _('search the repository as it stood at rev')), |
|
2328 | [('r', 'rev', '', _('search the repository as it stood at rev')), | |
2310 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
2329 | ('0', 'print0', None, | |
2311 | ('f', 'fullpath', None, _('print complete paths from the filesystem root')), |
|
2330 | _('end filenames with NUL, for use with xargs')), | |
|
2331 | ('f', 'fullpath', None, | |||
|
2332 | _('print complete paths from the filesystem root')), | |||
2312 | ('I', 'include', [], _('include names matching the given patterns')), |
|
2333 | ('I', 'include', [], _('include names matching the given patterns')), | |
2313 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
|
2334 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], | |
2314 | _('hg locate [OPTION]... [PATTERN]...')), |
|
2335 | _('hg locate [OPTION]... [PATTERN]...')), | |
@@ -2333,16 +2354,19 b' table = {' | |||||
2333 | "paths": (paths, [], _('hg paths [NAME]')), |
|
2354 | "paths": (paths, [], _('hg paths [NAME]')), | |
2334 | "^pull": |
|
2355 | "^pull": | |
2335 | (pull, |
|
2356 | (pull, | |
2336 | [('u', 'update', None, _('update the working directory to tip after pull')), |
|
2357 | [('u', 'update', None, | |
|
2358 | _('update the working directory to tip after pull')), | |||
2337 | ('e', 'ssh', "", _('specify ssh command to use')), |
|
2359 | ('e', 'ssh', "", _('specify ssh command to use')), | |
2338 | ('r', 'rev', [], _('a specific revision you would like to pull')), |
|
2360 | ('r', 'rev', [], _('a specific revision you would like to pull')), | |
2339 | ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
|
2361 | ('', 'remotecmd', "", | |
|
2362 | _('specify hg command to run on the remote side'))], | |||
2340 | _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')), |
|
2363 | _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')), | |
2341 | "^push": |
|
2364 | "^push": | |
2342 | (push, |
|
2365 | (push, | |
2343 | [('f', 'force', None, _('force push')), |
|
2366 | [('f', 'force', None, _('force push')), | |
2344 | ('e', 'ssh', "", _('specify ssh command to use')), |
|
2367 | ('e', 'ssh', "", _('specify ssh command to use')), | |
2345 | ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
|
2368 | ('', 'remotecmd', "", | |
|
2369 | _('specify hg command to run on the remote side'))], | |||
2346 | _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), |
|
2370 | _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), | |
2347 | "rawcommit": |
|
2371 | "rawcommit": | |
2348 | (rawcommit, |
|
2372 | (rawcommit, | |
@@ -2355,14 +2379,20 b' table = {' | |||||
2355 | _('hg rawcommit [OPTION]... [FILE]...')), |
|
2379 | _('hg rawcommit [OPTION]... [FILE]...')), | |
2356 | "recover": (recover, [], _("hg recover")), |
|
2380 | "recover": (recover, [], _("hg recover")), | |
2357 | "^remove|rm": (remove, |
|
2381 | "^remove|rm": (remove, | |
2358 |
[('I', 'include', [], |
|
2382 | [('I', 'include', [], | |
2359 |
|
|
2383 | _('include names matching the given patterns')), | |
|
2384 | ('X', 'exclude', [], | |||
|
2385 | _('exclude names matching the given patterns'))], | |||
2360 | _("hg remove [OPTION]... FILE...")), |
|
2386 | _("hg remove [OPTION]... FILE...")), | |
2361 | "rename|mv": (rename, |
|
2387 | "rename|mv": (rename, | |
2362 |
[('I', 'include', [], |
|
2388 | [('I', 'include', [], | |
2363 |
|
|
2389 | _('include names matching the given patterns')), | |
2364 | ('A', 'after', None, _('record a rename that has already occurred')), |
|
2390 | ('X', 'exclude', [], | |
2365 | ('f', 'force', None, _('forcibly copy over an existing managed file'))], |
|
2391 | _('exclude names matching the given patterns')), | |
|
2392 | ('A', 'after', None, | |||
|
2393 | _('record a rename that has already occurred')), | |||
|
2394 | ('f', 'force', None, | |||
|
2395 | _('forcibly copy over an existing managed file'))], | |||
2366 | _('hg rename [OPTION]... [SOURCE]... DEST')), |
|
2396 | _('hg rename [OPTION]... [SOURCE]... DEST')), | |
2367 | "^revert": |
|
2397 | "^revert": | |
2368 | (revert, |
|
2398 | (revert, | |
@@ -2377,7 +2407,8 b' table = {' | |||||
2377 | ('E', 'errorlog', '', _('name of error log file to write to')), |
|
2407 | ('E', 'errorlog', '', _('name of error log file to write to')), | |
2378 | ('p', 'port', 0, _('port to use (default: 8000)')), |
|
2408 | ('p', 'port', 0, _('port to use (default: 8000)')), | |
2379 | ('a', 'address', '', _('address to use')), |
|
2409 | ('a', 'address', '', _('address to use')), | |
2380 | ('n', 'name', "", _('name to show in web pages (default: working dir)')), |
|
2410 | ('n', 'name', "", | |
|
2411 | _('name to show in web pages (default: working dir)')), | |||
2381 | ('', 'stdio', None, _('for remote clients')), |
|
2412 | ('', 'stdio', None, _('for remote clients')), | |
2382 | ('t', 'templates', "", _('web templates to use')), |
|
2413 | ('t', 'templates', "", _('web templates to use')), | |
2383 | ('', 'style', "", _('template style to use')), |
|
2414 | ('', 'style', "", _('template style to use')), | |
@@ -2390,7 +2421,8 b' table = {' | |||||
2390 | ('r', 'removed', None, _('show only removed files')), |
|
2421 | ('r', 'removed', None, _('show only removed files')), | |
2391 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
|
2422 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), | |
2392 | ('n', 'no-status', None, _('hide status prefix')), |
|
2423 | ('n', 'no-status', None, _('hide status prefix')), | |
2393 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
2424 | ('0', 'print0', None, | |
|
2425 | _('end filenames with NUL, for use with xargs')), | |||
2394 | ('I', 'include', [], _('include names matching the given patterns')), |
|
2426 | ('I', 'include', [], _('include names matching the given patterns')), | |
2395 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
|
2427 | ('X', 'exclude', [], _('exclude names matching the given patterns'))], | |
2396 | _("hg status [OPTION]... [FILE]...")), |
|
2428 | _("hg status [OPTION]... [FILE]...")), | |
@@ -2406,8 +2438,9 b' table = {' | |||||
2406 | "tip": (tip, [], _('hg tip')), |
|
2438 | "tip": (tip, [], _('hg tip')), | |
2407 | "unbundle": |
|
2439 | "unbundle": | |
2408 | (unbundle, |
|
2440 | (unbundle, | |
2409 | [], |
|
2441 | [('u', 'update', None, | |
2410 | _('hg unbundle FILE')), |
|
2442 | _('update the working directory to tip after unbundle'))], | |
|
2443 | _('hg unbundle [-u] FILE')), | |||
2411 | "undo": (undo, [], _('hg undo')), |
|
2444 | "undo": (undo, [], _('hg undo')), | |
2412 | "^update|up|checkout|co": |
|
2445 | "^update|up|checkout|co": | |
2413 | (update, |
|
2446 | (update, | |
@@ -2423,7 +2456,8 b' table = {' | |||||
2423 | globalopts = [ |
|
2456 | globalopts = [ | |
2424 | ('R', 'repository', "", _("repository root directory")), |
|
2457 | ('R', 'repository', "", _("repository root directory")), | |
2425 | ('', 'cwd', '', _("change working directory")), |
|
2458 | ('', 'cwd', '', _("change working directory")), | |
2426 | ('y', 'noninteractive', None, _("do not prompt, assume 'yes' for any required answers")), |
|
2459 | ('y', 'noninteractive', None, | |
|
2460 | _("do not prompt, assume 'yes' for any required answers")), | |||
2427 | ('q', 'quiet', None, _("suppress output")), |
|
2461 | ('q', 'quiet', None, _("suppress output")), | |
2428 | ('v', 'verbose', None, _("enable additional output")), |
|
2462 | ('v', 'verbose', None, _("enable additional output")), | |
2429 | ('', 'debug', None, _("enable debugging output")), |
|
2463 | ('', 'debug', None, _("enable debugging output")), |
@@ -400,10 +400,6 b' class localrepository(object):' | |||||
400 | fp1 = m1.get(f, nullid) |
|
400 | fp1 = m1.get(f, nullid) | |
401 | fp2 = m2.get(f, nullid) |
|
401 | fp2 = m2.get(f, nullid) | |
402 |
|
402 | |||
403 | # is the same revision on two branches of a merge? |
|
|||
404 | if fp2 == fp1: |
|
|||
405 | fp2 = nullid |
|
|||
406 |
|
||||
407 | if fp2 != nullid: |
|
403 | if fp2 != nullid: | |
408 | # is one parent an ancestor of the other? |
|
404 | # is one parent an ancestor of the other? | |
409 | fpa = r.ancestor(fp1, fp2) |
|
405 | fpa = r.ancestor(fp1, fp2) | |
@@ -413,7 +409,7 b' class localrepository(object):' | |||||
413 | fp2 = nullid |
|
409 | fp2 = nullid | |
414 |
|
410 | |||
415 | # is the file unmodified from the parent? |
|
411 | # is the file unmodified from the parent? | |
416 | if not meta and t == r.read(fp1): |
|
412 | if not meta and t == r.read(fp1) and fp2 == nullid: | |
417 | # record the proper existing parent in manifest |
|
413 | # record the proper existing parent in manifest | |
418 | # no need to add a revision |
|
414 | # no need to add a revision | |
419 | new[f] = fp1 |
|
415 | new[f] = fp1 |
@@ -188,6 +188,7 b' class revlog(object):' | |||||
188 | self.datafile = datafile |
|
188 | self.datafile = datafile | |
189 | self.opener = opener |
|
189 | self.opener = opener | |
190 | self.cache = None |
|
190 | self.cache = None | |
|
191 | self.chunkcache = None | |||
191 |
|
192 | |||
192 | try: |
|
193 | try: | |
193 | i = self.opener(self.indexfile).read() |
|
194 | i = self.opener(self.indexfile).read() | |
@@ -473,6 +474,35 b' class revlog(object):' | |||||
473 | """apply a list of patches to a string""" |
|
474 | """apply a list of patches to a string""" | |
474 | return mdiff.patches(t, pl) |
|
475 | return mdiff.patches(t, pl) | |
475 |
|
476 | |||
|
477 | def chunk(self, rev): | |||
|
478 | start, length = self.start(rev), self.length(rev) | |||
|
479 | end = start + length | |||
|
480 | ||||
|
481 | def loadcache(): | |||
|
482 | cache_length = max(4096 * 1024, length) # 4Mo | |||
|
483 | df = self.opener(self.datafile) | |||
|
484 | df.seek(start) | |||
|
485 | self.chunkcache = (start, df.read(cache_length)) | |||
|
486 | ||||
|
487 | if not self.chunkcache: | |||
|
488 | loadcache() | |||
|
489 | ||||
|
490 | cache_start = self.chunkcache[0] | |||
|
491 | cache_end = cache_start + len(self.chunkcache[1]) | |||
|
492 | if start >= cache_start and end <= cache_end: | |||
|
493 | # it is cached | |||
|
494 | offset = start - cache_start | |||
|
495 | else: | |||
|
496 | loadcache() | |||
|
497 | offset = 0 | |||
|
498 | ||||
|
499 | #def checkchunk(): | |||
|
500 | # df = self.opener(self.datafile) | |||
|
501 | # df.seek(start) | |||
|
502 | # return df.read(length) | |||
|
503 | #assert s == checkchunk() | |||
|
504 | return decompress(self.chunkcache[1][offset:offset + length]) | |||
|
505 | ||||
476 | def delta(self, node): |
|
506 | def delta(self, node): | |
477 | """return or calculate a delta between a node and its predecessor""" |
|
507 | """return or calculate a delta between a node and its predecessor""" | |
478 | r = self.rev(node) |
|
508 | r = self.rev(node) | |
@@ -481,10 +511,7 b' class revlog(object):' | |||||
481 | return self.diff(self.revision(self.node(r - 1)), |
|
511 | return self.diff(self.revision(self.node(r - 1)), | |
482 | self.revision(node)) |
|
512 | self.revision(node)) | |
483 | else: |
|
513 | else: | |
484 | f = self.opener(self.datafile) |
|
514 | return self.chunk(r) | |
485 | f.seek(self.start(r)) |
|
|||
486 | data = f.read(self.length(r)) |
|
|||
487 | return decompress(data) |
|
|||
488 |
|
515 | |||
489 | def revision(self, node): |
|
516 | def revision(self, node): | |
490 | """return an uncompressed revision of a given""" |
|
517 | """return an uncompressed revision of a given""" | |
@@ -494,33 +521,22 b' class revlog(object):' | |||||
494 | # look up what we need to read |
|
521 | # look up what we need to read | |
495 | text = None |
|
522 | text = None | |
496 | rev = self.rev(node) |
|
523 | rev = self.rev(node) | |
497 | start, length, base, link, p1, p2, node = self.index[rev] |
|
524 | base = self.base(rev) | |
498 | end = start + length |
|
|||
499 | if base != rev: start = self.start(base) |
|
|||
500 |
|
525 | |||
501 | # do we have useful data cached? |
|
526 | # do we have useful data cached? | |
502 | if self.cache and self.cache[1] >= base and self.cache[1] < rev: |
|
527 | if self.cache and self.cache[1] >= base and self.cache[1] < rev: | |
503 | base = self.cache[1] |
|
528 | base = self.cache[1] | |
504 | start = self.start(base + 1) |
|
|||
505 | text = self.cache[2] |
|
529 | text = self.cache[2] | |
506 |
|
|
530 | else: | |
507 |
|
531 | text = self.chunk(base) | ||
508 | f = self.opener(self.datafile) |
|
|||
509 | f.seek(start) |
|
|||
510 | data = f.read(end - start) |
|
|||
511 |
|
||||
512 | if text is None: |
|
|||
513 | last = self.length(base) |
|
|||
514 | text = decompress(data[:last]) |
|
|||
515 |
|
532 | |||
516 | bins = [] |
|
533 | bins = [] | |
517 | for r in xrange(base + 1, rev + 1): |
|
534 | for r in xrange(base + 1, rev + 1): | |
518 |
|
|
535 | bins.append(self.chunk(r)) | |
519 | bins.append(decompress(data[last:last + s])) |
|
|||
520 | last = last + s |
|
|||
521 |
|
536 | |||
522 | text = mdiff.patches(text, bins) |
|
537 | text = mdiff.patches(text, bins) | |
523 |
|
538 | |||
|
539 | p1, p2 = self.parents(node) | |||
524 | if node != hash(text, p1, p2): |
|
540 | if node != hash(text, p1, p2): | |
525 | raise RevlogError(_("integrity check failed on %s:%d") |
|
541 | raise RevlogError(_("integrity check failed on %s:%d") | |
526 | % (self.datafile, rev)) |
|
542 | % (self.datafile, rev)) | |
@@ -650,7 +666,7 b' class revlog(object):' | |||||
650 | #print "next x" |
|
666 | #print "next x" | |
651 | gx = x.next() |
|
667 | gx = x.next() | |
652 |
|
668 | |||
653 |
def group(self, nodelist, lookup, infocollect |
|
669 | def group(self, nodelist, lookup, infocollect=None): | |
654 | """calculate a delta group |
|
670 | """calculate a delta group | |
655 |
|
671 | |||
656 | Given a list of changeset revs, return a set of deltas and |
|
672 | Given a list of changeset revs, return a set of deltas and | |
@@ -660,7 +676,6 b' class revlog(object):' | |||||
660 | changesets. parent is parent[0] |
|
676 | changesets. parent is parent[0] | |
661 | """ |
|
677 | """ | |
662 | revs = [self.rev(n) for n in nodelist] |
|
678 | revs = [self.rev(n) for n in nodelist] | |
663 | needed = dict.fromkeys(revs, 1) |
|
|||
664 |
|
679 | |||
665 | # if we don't have any revisions touched by these changesets, bail |
|
680 | # if we don't have any revisions touched by these changesets, bail | |
666 | if not revs: |
|
681 | if not revs: | |
@@ -671,88 +686,30 b' class revlog(object):' | |||||
671 | p = self.parents(self.node(revs[0]))[0] |
|
686 | p = self.parents(self.node(revs[0]))[0] | |
672 | revs.insert(0, self.rev(p)) |
|
687 | revs.insert(0, self.rev(p)) | |
673 |
|
688 | |||
674 | # for each delta that isn't contiguous in the log, we need to |
|
|||
675 | # reconstruct the base, reconstruct the result, and then |
|
|||
676 | # calculate the delta. We also need to do this where we've |
|
|||
677 | # stored a full version and not a delta |
|
|||
678 | for i in xrange(0, len(revs) - 1): |
|
|||
679 | a, b = revs[i], revs[i + 1] |
|
|||
680 | if a + 1 != b or self.base(b) == b: |
|
|||
681 | for j in xrange(self.base(a), a + 1): |
|
|||
682 | needed[j] = 1 |
|
|||
683 | for j in xrange(self.base(b), b + 1): |
|
|||
684 | needed[j] = 1 |
|
|||
685 |
|
||||
686 | # calculate spans to retrieve from datafile |
|
|||
687 | needed = needed.keys() |
|
|||
688 | needed.sort() |
|
|||
689 | spans = [] |
|
|||
690 | oo = -1 |
|
|||
691 | ol = 0 |
|
|||
692 | for n in needed: |
|
|||
693 | if n < 0: continue |
|
|||
694 | o = self.start(n) |
|
|||
695 | l = self.length(n) |
|
|||
696 | if oo + ol == o: # can we merge with the previous? |
|
|||
697 | nl = spans[-1][2] |
|
|||
698 | nl.append((n, l)) |
|
|||
699 | ol += l |
|
|||
700 | spans[-1] = (oo, ol, nl) |
|
|||
701 | else: |
|
|||
702 | oo = o |
|
|||
703 | ol = l |
|
|||
704 | spans.append((oo, ol, [(n, l)])) |
|
|||
705 |
|
||||
706 | # read spans in, divide up chunks |
|
|||
707 | chunks = {} |
|
|||
708 | for span in spans: |
|
|||
709 | # we reopen the file for each span to make http happy for now |
|
|||
710 | f = self.opener(self.datafile) |
|
|||
711 | f.seek(span[0]) |
|
|||
712 | data = f.read(span[1]) |
|
|||
713 |
|
||||
714 | # divide up the span |
|
|||
715 | pos = 0 |
|
|||
716 | for r, l in span[2]: |
|
|||
717 | chunks[r] = decompress(data[pos: pos + l]) |
|
|||
718 | pos += l |
|
|||
719 |
|
||||
720 | # helper to reconstruct intermediate versions |
|
689 | # helper to reconstruct intermediate versions | |
721 | def construct(text, base, rev): |
|
690 | def construct(text, base, rev): | |
722 |
bins = [ |
|
691 | bins = [self.chunk(r) for r in xrange(base + 1, rev + 1)] | |
723 | return mdiff.patches(text, bins) |
|
692 | return mdiff.patches(text, bins) | |
724 |
|
693 | |||
725 | # build deltas |
|
694 | # build deltas | |
726 | deltas = [] |
|
|||
727 | for d in xrange(0, len(revs) - 1): |
|
695 | for d in xrange(0, len(revs) - 1): | |
728 | a, b = revs[d], revs[d + 1] |
|
696 | a, b = revs[d], revs[d + 1] | |
729 |
n = self.node( |
|
697 | na = self.node(a) | |
|
698 | nb = self.node(b) | |||
730 |
|
699 | |||
731 | if infocollect is not None: |
|
700 | if infocollect is not None: | |
732 | infocollect(n) |
|
701 | infocollect(nb) | |
733 |
|
702 | |||
734 | # do we need to construct a new delta? |
|
703 | # do we need to construct a new delta? | |
735 | if a + 1 != b or self.base(b) == b: |
|
704 | if a + 1 != b or self.base(b) == b: | |
736 |
|
|
705 | ta = self.revision(na) | |
737 |
|
|
706 | tb = self.revision(nb) | |
738 | ta = chunks[self.base(a)] |
|
|||
739 | ta = construct(ta, base, a) |
|
|||
740 | else: |
|
|||
741 | ta = "" |
|
|||
742 |
|
||||
743 | base = self.base(b) |
|
|||
744 | if a > base: |
|
|||
745 | base = a |
|
|||
746 | tb = ta |
|
|||
747 | else: |
|
|||
748 | tb = chunks[self.base(b)] |
|
|||
749 | tb = construct(tb, base, b) |
|
|||
750 | d = self.diff(ta, tb) |
|
707 | d = self.diff(ta, tb) | |
751 | else: |
|
708 | else: | |
752 |
d = |
|
709 | d = self.chunk(b) | |
753 |
|
710 | |||
754 | p = self.parents(n) |
|
711 | p = self.parents(nb) | |
755 | meta = n + p[0] + p[1] + lookup(n) |
|
712 | meta = nb + p[0] + p[1] + lookup(nb) | |
756 | l = struct.pack(">l", len(meta) + len(d) + 4) |
|
713 | l = struct.pack(">l", len(meta) + len(d) + 4) | |
757 | yield l |
|
714 | yield l | |
758 | yield meta |
|
715 | yield meta |
@@ -35,6 +35,8 b' class statichttprepository(localrepo.loc' | |||||
35 | self.changelog = changelog.changelog(self.opener) |
|
35 | self.changelog = changelog.changelog(self.opener) | |
36 | self.tagscache = None |
|
36 | self.tagscache = None | |
37 | self.nodetagscache = None |
|
37 | self.nodetagscache = None | |
|
38 | self.encodepats = None | |||
|
39 | self.decodepats = None | |||
38 |
|
40 | |||
39 | def dev(self): |
|
41 | def dev(self): | |
40 | return -1 |
|
42 | return -1 |
@@ -11,6 +11,13 b' hg history' | |||||
11 | echo foo >> .hgtags |
|
11 | echo foo >> .hgtags | |
12 | hg tag -d "0 0" "bleah2" || echo "failed" |
|
12 | hg tag -d "0 0" "bleah2" || echo "failed" | |
13 |
|
13 | |||
|
14 | hg revert .hgtags | |||
|
15 | hg tag -d "0 0" -r 0 "bleah0" | |||
|
16 | hg tag -l -d "0 0" "bleah1" 1 | |||
|
17 | ||||
|
18 | cat .hgtags | |||
|
19 | cat .hg/localtags | |||
|
20 | ||||
14 | hg tag -l 'xx |
|
21 | hg tag -l 'xx | |
15 | newline' |
|
22 | newline' | |
16 | hg tag -l 'xx:xx' |
|
23 | hg tag -l 'xx:xx' |
@@ -18,5 +18,8 b' summary: test' | |||||
18 |
|
18 | |||
19 | abort: working copy of .hgtags is changed (please commit .hgtags manually) |
|
19 | abort: working copy of .hgtags is changed (please commit .hgtags manually) | |
20 | failed |
|
20 | failed | |
|
21 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah | |||
|
22 | acb14030fe0a21b60322c440ad2d20cf7685a376 bleah0 | |||
|
23 | 863197ef03781c4fc00276d83eb66c4cb9cd91df bleah1 | |||
21 | abort: '\n' cannot be used in a tag name |
|
24 | abort: '\n' cannot be used in a tag name | |
22 | abort: ':' cannot be used in a tag name |
|
25 | abort: ':' cannot be used in a tag name |
General Comments 0
You need to be logged in to leave comments.
Login now