mercurial/commands.py
changeset 1191 77a0c7528c2f
parent 1190 737f9b90c571
child 1192 6e165de907c5
equal deleted inserted replaced
1190:737f9b90c571 1191:77a0c7528c2f
  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", **opts):
  1067 def incoming(ui, repo, source="default"):
  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")
       
  1086 
  1082 
  1087 def init(ui, dest="."):
  1083 def init(ui, dest="."):
  1088     """create a new repository in the given directory"""
  1084     """create a new repository in the given directory"""
  1089     if not os.path.exists(dest):
  1085     if not os.path.exists(dest):
  1090         os.mkdir(dest)
  1086         os.mkdir(dest)
  1162     files.sort()
  1158     files.sort()
  1163 
  1159 
  1164     for f in files:
  1160     for f in files:
  1165         ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
  1161         ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
  1166 
  1162 
  1167 def outgoing(ui, repo, dest="default-push", **opts):
  1163 def outgoing(ui, repo, dest="default-push"):
  1168     """show changesets not found in destination"""
  1164     """show changesets not found in destination"""
  1169     dest = ui.expandpath(dest)
  1165     dest = ui.expandpath(dest)
  1170     other = hg.repository(ui, dest)
  1166     other = hg.repository(ui, dest)
  1171     o = repo.findoutgoing(other)
  1167     o = repo.findoutgoing(other)
  1172     o = repo.newer(o)
  1168     o = repo.newer(o)
  1173     o.reverse()
  1169     o.reverse()
  1174     for n in o:
  1170     for n in o:
  1175         show_changeset(ui, repo, changenode=n)
  1171         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")
       
  1180 
  1172 
  1181 def parents(ui, repo, rev=None):
  1173 def parents(ui, repo, rev=None):
  1182     """show the parents of the working dir or revision"""
  1174     """show the parents of the working dir or revision"""
  1183     if rev:
  1175     if rev:
  1184         p = repo.changelog.parents(repo.lookup(rev))
  1176         p = repo.changelog.parents(repo.lookup(rev))
  1669          [('p', 'strip', 1, 'path strip'),
  1661          [('p', 'strip', 1, 'path strip'),
  1670           ('f', 'force', None, 'skip check for outstanding changes'),
  1662           ('f', 'force', None, 'skip check for outstanding changes'),
  1671           ('b', 'base', "", 'base path'),
  1663           ('b', 'base', "", 'base path'),
  1672           ('m', 'mail-like', None, 'apply a patch that looks like email')],
  1664           ('m', 'mail-like', None, 'apply a patch that looks like email')],
  1673          "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
  1665          "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
  1674     "incoming|in": (incoming, 
  1666     "incoming|in": (incoming, [], 'hg incoming [SOURCE]'),
  1675          [('p', 'patch', None, 'show patch')],
       
  1676          'hg incoming [-p] [SOURCE]'),
       
  1677     "^init": (init, [], 'hg init [DEST]'),
  1667     "^init": (init, [], 'hg init [DEST]'),
  1678     "locate":
  1668     "locate":
  1679         (locate,
  1669         (locate,
  1680          [('r', 'rev', '', 'revision'),
  1670          [('r', 'rev', '', 'revision'),
  1681           ('0', 'print0', None, 'end filenames with NUL'),
  1671           ('0', 'print0', None, 'end filenames with NUL'),
  1689           ('X', 'exclude', [], 'exclude path from search'),
  1679           ('X', 'exclude', [], 'exclude path from search'),
  1690           ('r', 'rev', [], 'revision'),
  1680           ('r', 'rev', [], 'revision'),
  1691           ('p', 'patch', None, 'show patch')],
  1681           ('p', 'patch', None, 'show patch')],
  1692          'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
  1682          'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
  1693     "manifest": (manifest, [], 'hg manifest [REV]'),
  1683     "manifest": (manifest, [], 'hg manifest [REV]'),
  1694     "outgoing|out": (outgoing, 
  1684     "outgoing|out": (outgoing, [], 'hg outgoing [DEST]'),
  1695          [('p', 'patch', None, 'show patch')],
       
  1696          'hg outgoing [-p] [DEST]'),
       
  1697     "parents": (parents, [], 'hg parents [REV]'),
  1685     "parents": (parents, [], 'hg parents [REV]'),
  1698     "paths": (paths, [], 'hg paths [NAME]'),
  1686     "paths": (paths, [], 'hg paths [NAME]'),
  1699     "^pull":
  1687     "^pull":
  1700         (pull,
  1688         (pull,
  1701          [('u', 'update', None, 'update working directory'),
  1689          [('u', 'update', None, 'update working directory'),