##// END OF EJS Templates
import and startup cleanups...
mpm@selenic.com -
r249:619e775a default
parent child Browse files
Show More
@@ -8,16 +8,7 b''
8 8 # This software may be used and distributed according to the terms
9 9 # of the GNU General Public License, incorporated herein by reference.
10 10
11 # the psyco compiler makes commits a bit faster
12 # and makes changegroup merge about 20 times slower!
13 # try:
14 # import psyco
15 # psyco.full()
16 # except:
17 # pass
18
19 import sys
20 11 from mercurial import commands
21 12
22 sys.exit(commands.dispatch(sys.argv[1:]))
13 commands.run()
23 14
@@ -1,4 +1,11 b''
1 import os, re, traceback, sys, signal, time, mdiff
1 # commands.py - command processing for mercurial
2 #
3 # Copyright 2005 Matt Mackall <mpm@selenic.com>
4 #
5 # This software may be used and distributed according to the terms
6 # of the GNU General Public License, incorporated herein by reference.
7
8 import os, re, sys, signal, time, mdiff
2 9 from mercurial import fancyopts, ui, hg
3 10
4 11 class UnknownCommand(Exception): pass
@@ -522,6 +529,9 b' class SignalInterrupt(Exception): pass'
522 529 def catchterm(*args):
523 530 raise SignalInterrupt
524 531
532 def run():
533 sys.exit(dispatch(sys.argv[1:]))
534
525 535 def dispatch(args):
526 536 options = {}
527 537 opts = [('v', 'verbose', None, 'verbose'),
@@ -562,6 +572,7 b' def dispatch(args):'
562 572 except KeyboardInterrupt:
563 573 u.warn("interrupted!\n")
564 574 except TypeError, inst:
575 import traceback
565 576 # was this an argument error?
566 577 tb = traceback.extract_tb(sys.exc_info()[2])
567 578 if len(tb) > 2: # no
@@ -5,9 +5,8 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 sys, struct, sha, socket, os, time, re, urllib2, tempfile
9 import urllib
10 from mercurial import byterange, lock
8 import sys, struct, os
9 from mercurial import lock
11 10 from mercurial.transaction import *
12 11 from mercurial.revlog import *
13 12 from difflib import SequenceMatcher
@@ -139,6 +138,7 b' class changelog(revlog):'
139 138
140 139 def add(self, manifest, list, desc, transaction, p1=None, p2=None,
141 140 user=None, date=None):
141 import socket, time
142 142 user = (user or
143 143 os.environ.get("HGUSER") or
144 144 os.environ.get("EMAIL") or
@@ -315,6 +315,7 b' class localrepository:'
315 315 self.dirstate = dirstate(self.opener, ui, self.root)
316 316
317 317 def ignore(self, f):
318 import re
318 319 if self.ignorelist is None:
319 320 self.ignorelist = []
320 321 try:
@@ -966,6 +967,8 b' class localrepository:'
966 967
967 968 def merge3(self, fn, my, other):
968 969 """perform a 3-way merge in the working directory"""
970
971 import tempfile
969 972
970 973 def temp(prefix, node):
971 974 pre = "%s~%s." % (os.path.basename(fn), prefix)
@@ -1177,10 +1180,14 b' class remoterepository:'
1177 1180
1178 1181 def repository(ui, path=None, create=0):
1179 1182 if path and path[:7] == "http://":
1183 import urllib, urllib2
1180 1184 return remoterepository(ui, path)
1181 1185 if path and path[:5] == "hg://":
1186 import urllib, urllib2
1182 1187 return remoterepository(ui, path.replace("hg://", "http://"))
1183 1188 if path and path[:11] == "old-http://":
1189 import urllib, urllib2
1190 from mercurial import byterange
1184 1191 return localrepository(ui, path.replace("old-http://", "http://"))
1185 1192 else:
1186 1193 return localrepository(ui, path, create)
@@ -5,7 +5,7 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 difflib, struct, mmap
8 import difflib, struct
9 9 from mercurial.mpatch import *
10 10
11 11 def unidiff(a, ad, b, bd, fn):
@@ -5,7 +5,7 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, tempfile, sys, re
8 import os, sys, re
9 9
10 10 class ui:
11 11 def __init__(self, verbose=False, debug=False, quiet=False,
@@ -37,6 +37,7 b' class ui:'
37 37 def debug(self, *msg):
38 38 if self.debugflag: self.write(*msg)
39 39 def edit(self, text):
40 import tempfile
40 41 (fd, name) = tempfile.mkstemp("hg")
41 42 f = os.fdopen(fd, "w")
42 43 f.write(text)
General Comments 0
You need to be logged in to leave comments. Login now