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