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