##// END OF EJS Templates
replace hg branch with hg init [source]...
mpm@selenic.com -
r290:07c6cb9f default
parent child Browse files
Show More
@@ -153,11 +153,6 b' def annotate(u, repo, file, *files, **op'
153 for p,l in zip(zip(*pieces), lines):
153 for p,l in zip(zip(*pieces), lines):
154 u.write(" ".join(p) + ": " + l[1])
154 u.write(" ".join(p) + ": " + l[1])
155
155
156 def branch(ui, path):
157 '''branch from a local repository'''
158 # this should eventually support remote repos
159 os.system("cp -al %s/.hg .hg" % path)
160
161 def cat(ui, repo, file, rev = []):
156 def cat(ui, repo, file, rev = []):
162 """output the latest or given revision of a file"""
157 """output the latest or given revision of a file"""
163 r = repo.file(relpath(repo, [file])[0])
158 r = repo.file(relpath(repo, [file])[0])
@@ -281,10 +276,33 b' def history(ui, repo):'
281 print "description:"
276 print "description:"
282 print changes[4]
277 print changes[4]
283
278
284 def init(ui):
279 def init(ui, source=None):
285 """create a repository"""
280 """create a new repository or copy an existing one"""
286 hg.repository(ui, ".", create=1)
281
282 if source:
283 paths = {}
284 for name, path in ui.configitems("paths"):
285 paths[name] = path
286
287 if source in paths: source = paths[source]
287
288
289 link = 0
290 if not source.startswith("http://"):
291 d1 = os.stat(os.getcwd()).st_dev
292 d2 = os.stat(source).st_dev
293 if d1 == d2: link = 1
294
295 if link:
296 ui.debug("copying by hardlink\n")
297 os.system("cp -al %s/.hg .hg" % source)
298 else:
299 repo = hg.repository(ui, ".", create=1)
300 other = hg.repository(ui, source)
301 cg = repo.getchangegroup(other)
302 repo.addchangegroup(cg)
303 else:
304 hg.repository(ui, ".", create=1)
305
288 def log(ui, repo, f):
306 def log(ui, repo, f):
289 """show the revision history of a single file"""
307 """show the revision history of a single file"""
290 f = relpath(repo, [f])[0]
308 f = relpath(repo, [f])[0]
@@ -367,7 +385,7 b' def pull(ui, repo, source):'
367 """pull changes from the specified source"""
385 """pull changes from the specified source"""
368 paths = {}
386 paths = {}
369 for name, path in ui.configitems("paths"):
387 for name, path in ui.configitems("paths"):
370 paths[name] = path
388 paths[name] = path
371
389
372 if source in paths: source = paths[source]
390 if source in paths: source = paths[source]
373
391
@@ -484,7 +502,6 b' table = {'
484 ('n', 'number', None, 'show revision number'),
502 ('n', 'number', None, 'show revision number'),
485 ('c', 'changeset', None, 'show changeset')],
503 ('c', 'changeset', None, 'show changeset')],
486 'hg annotate [-u] [-c] [-n] [-r id] [files]'),
504 'hg annotate [-u] [-c] [-n] [-r id] [files]'),
487 "branch|clone": (branch, [], 'hg branch [path]'),
488 "cat|dump": (cat, [], 'hg cat <file> [rev]'),
505 "cat|dump": (cat, [], 'hg cat <file> [rev]'),
489 "commit|ci": (commit,
506 "commit|ci": (commit,
490 [('t', 'text', "", 'commit text'),
507 [('t', 'text', "", 'commit text'),
@@ -501,7 +518,7 b' table = {'
501 "heads": (heads, [], 'hg heads'),
518 "heads": (heads, [], 'hg heads'),
502 "history": (history, [], 'hg history'),
519 "history": (history, [], 'hg history'),
503 "help": (help, [], 'hg help [command]'),
520 "help": (help, [], 'hg help [command]'),
504 "init": (init, [], 'hg init'),
521 "init": (init, [], 'hg init [url]'),
505 "log": (log, [], 'hg log <file>'),
522 "log": (log, [], 'hg log <file>'),
506 "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
523 "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
507 "parents": (parents, [], 'hg parents [node]'),
524 "parents": (parents, [], 'hg parents [node]'),
General Comments 0
You need to be logged in to leave comments. Login now