mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
Pull from hg://edge2.net/hg/cmds
This commit is contained in:
commit
b4850f98ce
30
hg
30
hg
@ -119,6 +119,10 @@ else:
|
||||
ui.warn("Unable to open repository\n")
|
||||
sys.exit(0)
|
||||
|
||||
relpath = None
|
||||
if os.getcwd() != repo.root:
|
||||
relpath = os.getcwd()[len(repo.root) + 1: ]
|
||||
|
||||
if cmd == "checkout" or cmd == "co":
|
||||
node = repo.changelog.tip()
|
||||
if args:
|
||||
@ -177,9 +181,12 @@ elif cmd == "import" or cmd == "patch":
|
||||
|
||||
elif cmd == "status":
|
||||
(c, a, d) = repo.diffdir(repo.root, repo.current)
|
||||
for f in c: ui.status("C %s\n" % f)
|
||||
for f in a: ui.status("? %s\n" % f)
|
||||
for f in d: ui.status("R %s\n" % f)
|
||||
if relpath:
|
||||
(c, a, d) = map(lambda x: filterfiles(x, [ relpath ]), (c, a, d))
|
||||
|
||||
for f in c: print "C", f
|
||||
for f in a: print "?", f
|
||||
for f in d: print "R", f
|
||||
|
||||
elif cmd == "diff":
|
||||
revs = []
|
||||
@ -195,8 +202,7 @@ elif cmd == "diff":
|
||||
self.ui.warn("too many revisions to diff\n")
|
||||
sys.exit(1)
|
||||
|
||||
if os.getcwd() != repo.root:
|
||||
relpath = os.getcwd()[len(repo.root) + 1: ]
|
||||
if relpath:
|
||||
if not args: args = [ relpath ]
|
||||
else: args = [ os.path.join(relpath, x) for x in args ]
|
||||
|
||||
@ -296,7 +302,11 @@ elif cmd == "tip":
|
||||
ui.status("%d:%s\n" % (t, hg.hex(n)))
|
||||
|
||||
elif cmd == "log":
|
||||
if args:
|
||||
|
||||
if len(args) == 1:
|
||||
if relpath:
|
||||
args[0] = os.path.join(relpath, args[0])
|
||||
|
||||
r = repo.file(args[0])
|
||||
for i in range(r.count()):
|
||||
n = r.node(i)
|
||||
@ -309,6 +319,14 @@ elif cmd == "log":
|
||||
print "changeset: %4d:%s" % (cr, cn)
|
||||
print "parents: %4d:%s" % (i1, h1)
|
||||
if i2: print " %4d:%s" % (i2, h2)
|
||||
changes = repo.changelog.read(repo.changelog.node(cr))
|
||||
print "user: %s date: %s" % (changes[1], time.asctime(
|
||||
time.localtime(float(changes[2].split(' ')[0]))))
|
||||
print "description:"
|
||||
print changes[4]
|
||||
print
|
||||
elif len(args) > 1:
|
||||
print "too many args"
|
||||
else:
|
||||
print "missing filename"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user