comparison mercurial/commands.py @ 1192:6e165de907c5

Add -p to incoming and outgoing commands to show patch
author TK Soh <teekaysoh@yahoo.com>
date Thu, 01 Sep 2005 09:11:25 -0700
parents 77a0c7528c2f
children 04d1ca8ae9ec
comparison
equal deleted inserted replaced
1191:77a0c7528c2f 1192:6e165de907c5
1062 1062
1063 if len(files) > 0: 1063 if len(files) > 0:
1064 addremove(ui, repo, *files) 1064 addremove(ui, repo, *files)
1065 repo.commit(files, message, user) 1065 repo.commit(files, message, user)
1066 1066
1067 def incoming(ui, repo, source="default"): 1067 def incoming(ui, repo, source="default", **opts):
1068 """show new changesets found in source""" 1068 """show new changesets found in source"""
1069 source = ui.expandpath(source) 1069 source = ui.expandpath(source)
1070 other = hg.repository(ui, source) 1070 other = hg.repository(ui, source)
1071 if not other.local(): 1071 if not other.local():
1072 ui.warn("abort: incoming doesn't work for remote" 1072 ui.warn("abort: incoming doesn't work for remote"
1077 return 1077 return
1078 o = other.newer(o) 1078 o = other.newer(o)
1079 o.reverse() 1079 o.reverse()
1080 for n in o: 1080 for n in o:
1081 show_changeset(ui, other, changenode=n) 1081 show_changeset(ui, other, changenode=n)
1082 if opts['patch']:
1083 prev = other.changelog.parents(n)[0]
1084 dodiff(ui, ui, other, prev, n)
1085 ui.write("\n")
1082 1086
1083 def init(ui, dest="."): 1087 def init(ui, dest="."):
1084 """create a new repository in the given directory""" 1088 """create a new repository in the given directory"""
1085 if not os.path.exists(dest): 1089 if not os.path.exists(dest):
1086 os.mkdir(dest) 1090 os.mkdir(dest)
1158 files.sort() 1162 files.sort()
1159 1163
1160 for f in files: 1164 for f in files:
1161 ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f)) 1165 ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
1162 1166
1163 def outgoing(ui, repo, dest="default-push"): 1167 def outgoing(ui, repo, dest="default-push", **opts):
1164 """show changesets not found in destination""" 1168 """show changesets not found in destination"""
1165 dest = ui.expandpath(dest) 1169 dest = ui.expandpath(dest)
1166 other = hg.repository(ui, dest) 1170 other = hg.repository(ui, dest)
1167 o = repo.findoutgoing(other) 1171 o = repo.findoutgoing(other)
1168 o = repo.newer(o) 1172 o = repo.newer(o)
1169 o.reverse() 1173 o.reverse()
1170 for n in o: 1174 for n in o:
1171 show_changeset(ui, repo, changenode=n) 1175 show_changeset(ui, repo, changenode=n)
1176 if opts['patch']:
1177 prev = repo.changelog.parents(n)[0]
1178 dodiff(ui, ui, repo, prev, n)
1179 ui.write("\n")
1172 1180
1173 def parents(ui, repo, rev=None): 1181 def parents(ui, repo, rev=None):
1174 """show the parents of the working dir or revision""" 1182 """show the parents of the working dir or revision"""
1175 if rev: 1183 if rev:
1176 p = repo.changelog.parents(repo.lookup(rev)) 1184 p = repo.changelog.parents(repo.lookup(rev))
1661 [('p', 'strip', 1, 'path strip'), 1669 [('p', 'strip', 1, 'path strip'),
1662 ('f', 'force', None, 'skip check for outstanding changes'), 1670 ('f', 'force', None, 'skip check for outstanding changes'),
1663 ('b', 'base', "", 'base path'), 1671 ('b', 'base', "", 'base path'),
1664 ('m', 'mail-like', None, 'apply a patch that looks like email')], 1672 ('m', 'mail-like', None, 'apply a patch that looks like email')],
1665 "hg import [-f] [-p NUM] [-b BASE] PATCH..."), 1673 "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
1666 "incoming|in": (incoming, [], 'hg incoming [SOURCE]'), 1674 "incoming|in": (incoming,
1675 [('p', 'patch', None, 'show patch')],
1676 'hg incoming [-p] [SOURCE]'),
1667 "^init": (init, [], 'hg init [DEST]'), 1677 "^init": (init, [], 'hg init [DEST]'),
1668 "locate": 1678 "locate":
1669 (locate, 1679 (locate,
1670 [('r', 'rev', '', 'revision'), 1680 [('r', 'rev', '', 'revision'),
1671 ('0', 'print0', None, 'end filenames with NUL'), 1681 ('0', 'print0', None, 'end filenames with NUL'),
1679 ('X', 'exclude', [], 'exclude path from search'), 1689 ('X', 'exclude', [], 'exclude path from search'),
1680 ('r', 'rev', [], 'revision'), 1690 ('r', 'rev', [], 'revision'),
1681 ('p', 'patch', None, 'show patch')], 1691 ('p', 'patch', None, 'show patch')],
1682 'hg log [-I] [-X] [-r REV]... [-p] [FILE]'), 1692 'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
1683 "manifest": (manifest, [], 'hg manifest [REV]'), 1693 "manifest": (manifest, [], 'hg manifest [REV]'),
1684 "outgoing|out": (outgoing, [], 'hg outgoing [DEST]'), 1694 "outgoing|out": (outgoing,
1695 [('p', 'patch', None, 'show patch')],
1696 'hg outgoing [-p] [DEST]'),
1685 "parents": (parents, [], 'hg parents [REV]'), 1697 "parents": (parents, [], 'hg parents [REV]'),
1686 "paths": (paths, [], 'hg paths [NAME]'), 1698 "paths": (paths, [], 'hg paths [NAME]'),
1687 "^pull": 1699 "^pull":
1688 (pull, 1700 (pull,
1689 [('u', 'update', None, 'update working directory'), 1701 [('u', 'update', None, 'update working directory'),