Show More
@@ -0,0 +1,15 b'' | |||
|
1 | def demandload(scope, modules): | |
|
2 | class d: | |
|
3 | def __getattr__(self, name): | |
|
4 | mod = self.__dict__["mod"] | |
|
5 | scope = self.__dict__["scope"] | |
|
6 | scope[mod] = __import__(mod, scope, scope, []) | |
|
7 | return getattr(scope[mod], name) | |
|
8 | ||
|
9 | for m in modules.split(): | |
|
10 | dl = d() | |
|
11 | dl.mod = m | |
|
12 | dl.scope = scope | |
|
13 | scope[m] = dl | |
|
14 | ||
|
15 |
@@ -5,8 +5,10 b'' | |||
|
5 | 5 | # This software may be used and distributed according to the terms |
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 |
import os, re, sys, signal |
|
|
9 |
|
|
|
8 | import os, re, sys, signal | |
|
9 | import fancyopts, ui, hg | |
|
10 | from demandload import * | |
|
11 | demandload(globals(), "mdiff time hgweb traceback") | |
|
10 | 12 | |
|
11 | 13 | class UnknownCommand(Exception): pass |
|
12 | 14 | |
@@ -397,7 +399,6 b' def remove(ui, repo, file, *files):' | |||
|
397 | 399 | |
|
398 | 400 | def serve(ui, repo, **opts): |
|
399 | 401 | """export the repository via HTTP""" |
|
400 | from mercurial import hgweb | |
|
401 | 402 | hgweb.server(repo.root, opts["name"], opts["templates"], |
|
402 | 403 | opts["address"], opts["port"]) |
|
403 | 404 | |
@@ -594,7 +595,6 b' def dispatch(args):' | |||
|
594 | 595 | else: |
|
595 | 596 | raise |
|
596 | 597 | except TypeError, inst: |
|
597 | import traceback | |
|
598 | 598 | # was this an argument error? |
|
599 | 599 | tb = traceback.extract_tb(sys.exc_info()[2]) |
|
600 | 600 | if len(tb) > 2: # no |
@@ -6,10 +6,10 b'' | |||
|
6 | 6 | # of the GNU General Public License, incorporated herein by reference. |
|
7 | 7 | |
|
8 | 8 | import sys, struct, os |
|
9 |
from |
|
|
10 |
from |
|
|
11 | from mercurial.revlog import * | |
|
12 | from difflib import SequenceMatcher | |
|
9 | from revlog import * | |
|
10 | from demandload import * | |
|
11 | demandload(globals(), "re lock urllib urllib2 transaction time socket") | |
|
12 | demandload(globals(), "tempfile byterange difflib") | |
|
13 | 13 | |
|
14 | 14 | class filelog(revlog): |
|
15 | 15 | def __init__(self, opener, path): |
@@ -32,7 +32,7 b' class filelog(revlog):' | |||
|
32 | 32 | |
|
33 | 33 | def pair(parent, child): |
|
34 | 34 | new = [] |
|
35 | sm = SequenceMatcher(None, strip(parent), strip(child)) | |
|
35 | sm = difflib.SequenceMatcher(None, strip(parent), strip(child)) | |
|
36 | 36 | for o, m, n, s, t in sm.get_opcodes(): |
|
37 | 37 | if o == 'equal': |
|
38 | 38 | new += parent[m:n] |
@@ -138,7 +138,6 b' class changelog(revlog):' | |||
|
138 | 138 | |
|
139 | 139 | def add(self, manifest, list, desc, transaction, p1=None, p2=None, |
|
140 | 140 | user=None, date=None): |
|
141 | import socket, time | |
|
142 | 141 | user = (user or |
|
143 | 142 | os.environ.get("HGUSER") or |
|
144 | 143 | os.environ.get("EMAIL") or |
@@ -310,7 +309,6 b' class localrepository:' | |||
|
310 | 309 | self.dirstate = dirstate(self.opener, ui, self.root) |
|
311 | 310 | |
|
312 | 311 | def ignore(self, f): |
|
313 | import re | |
|
314 | 312 | if self.ignorelist is None: |
|
315 | 313 | self.ignorelist = [] |
|
316 | 314 | try: |
@@ -358,14 +356,15 b' class localrepository:' | |||
|
358 | 356 | # save dirstate for undo |
|
359 | 357 | ds = self.opener("dirstate").read() |
|
360 | 358 | self.opener("undo.dirstate", "w").write(ds) |
|
361 | return transaction(self.opener, self.join("journal"), | |
|
362 | self.join("undo")) | |
|
359 | ||
|
360 | return transaction.transaction(self.opener, self.join("journal"), | |
|
361 | self.join("undo")) | |
|
363 | 362 | |
|
364 | 363 | def recover(self): |
|
365 | 364 | lock = self.lock() |
|
366 | 365 | if os.path.exists(self.join("recover")): |
|
367 | 366 | self.ui.status("attempting to rollback interrupted transaction\n") |
|
368 | return rollback(self.opener, self.join("recover")) | |
|
367 | return transaction.rollback(self.opener, self.join("recover")) | |
|
369 | 368 | else: |
|
370 | 369 | self.ui.warn("no interrupted transaction available\n") |
|
371 | 370 | |
@@ -373,7 +372,7 b' class localrepository:' | |||
|
373 | 372 | lock = self.lock() |
|
374 | 373 | if os.path.exists(self.join("undo")): |
|
375 | 374 | self.ui.status("attempting to rollback last transaction\n") |
|
376 | rollback(self.opener, self.join("undo")) | |
|
375 | transaction.rollback(self.opener, self.join("undo")) | |
|
377 | 376 | self.dirstate = None |
|
378 | 377 | os.rename(self.join("undo.dirstate"), self.join("dirstate")) |
|
379 | 378 | self.dirstate = dirstate(self.opener, self.ui, self.root) |
@@ -952,8 +951,6 b' class localrepository:' | |||
|
952 | 951 | def merge3(self, fn, my, other): |
|
953 | 952 | """perform a 3-way merge in the working directory""" |
|
954 | 953 | |
|
955 | import tempfile | |
|
956 | ||
|
957 | 954 | def temp(prefix, node): |
|
958 | 955 | pre = "%s~%s." % (os.path.basename(fn), prefix) |
|
959 | 956 | (fd, name) = tempfile.mkstemp("", pre) |
@@ -1164,14 +1161,10 b' class remoterepository:' | |||
|
1164 | 1161 | |
|
1165 | 1162 | def repository(ui, path=None, create=0): |
|
1166 | 1163 | if path and path[:7] == "http://": |
|
1167 | import urllib, urllib2 | |
|
1168 | 1164 | return remoterepository(ui, path) |
|
1169 | 1165 | if path and path[:5] == "hg://": |
|
1170 | import urllib, urllib2 | |
|
1171 | 1166 | return remoterepository(ui, path.replace("hg://", "http://")) |
|
1172 | 1167 | if path and path[:11] == "old-http://": |
|
1173 | import urllib, urllib2 | |
|
1174 | from mercurial import byterange | |
|
1175 | 1168 | return localrepository(ui, path.replace("old-http://", "http://")) |
|
1176 | 1169 | else: |
|
1177 | 1170 | return localrepository(ui, path, create) |
General Comments 0
You need to be logged in to leave comments.
Login now