mercurial/commands.py
changeset 1187 120aa5fc7ced
parent 1177 862f53c1d0f9
child 1188 b3ceb2d470fc
equal deleted inserted replaced
1186:508c7d1b3e1c 1187:120aa5fc7ced
  1056 
  1056 
  1057         if len(files) > 0:
  1057         if len(files) > 0:
  1058             addremove(ui, repo, *files)
  1058             addremove(ui, repo, *files)
  1059         repo.commit(files, message, user)
  1059         repo.commit(files, message, user)
  1060 
  1060 
  1061 def incoming(ui, repo, source="default"):
  1061 def incoming(ui, repo, source="default", **opts):
  1062     """show new changesets found in source"""
  1062     """show new changesets found in source"""
  1063     source = ui.expandpath(source)
  1063     source = ui.expandpath(source)
  1064     other = hg.repository(ui, source)
  1064     other = hg.repository(ui, source)
  1065     if not other.local():
  1065     if not other.local():
  1066         ui.warn("abort: incoming doesn't work for remote"
  1066         ui.warn("abort: incoming doesn't work for remote"
  1071         return
  1071         return
  1072     o = other.newer(o)
  1072     o = other.newer(o)
  1073     o.reverse()
  1073     o.reverse()
  1074     for n in o:
  1074     for n in o:
  1075         show_changeset(ui, other, changenode=n)
  1075         show_changeset(ui, other, changenode=n)
       
  1076         if opts['patch']:
       
  1077             prev = other.changelog.parents(n)[0]
       
  1078             dodiff(ui, ui, other, prev, n)
       
  1079             ui.write("\n")
  1076 
  1080 
  1077 def init(ui, dest="."):
  1081 def init(ui, dest="."):
  1078     """create a new repository in the given directory"""
  1082     """create a new repository in the given directory"""
  1079     if not os.path.exists(dest):
  1083     if not os.path.exists(dest):
  1080         os.mkdir(dest)
  1084         os.mkdir(dest)
  1152     files.sort()
  1156     files.sort()
  1153 
  1157 
  1154     for f in files:
  1158     for f in files:
  1155         ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
  1159         ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
  1156 
  1160 
  1157 def outgoing(ui, repo, dest="default-push"):
  1161 def outgoing(ui, repo, dest="default-push", **opts):
  1158     """show changesets not found in destination"""
  1162     """show changesets not found in destination"""
  1159     dest = ui.expandpath(dest)
  1163     dest = ui.expandpath(dest)
  1160     other = hg.repository(ui, dest)
  1164     other = hg.repository(ui, dest)
  1161     o = repo.findoutgoing(other)
  1165     o = repo.findoutgoing(other)
  1162     o = repo.newer(o)
  1166     o = repo.newer(o)
  1163     o.reverse()
  1167     o.reverse()
  1164     for n in o:
  1168     for n in o:
  1165         show_changeset(ui, repo, changenode=n)
  1169         show_changeset(ui, repo, changenode=n)
       
  1170         if opts['patch']:
       
  1171             prev = repo.changelog.parents(n)[0]
       
  1172             dodiff(ui, ui, repo, prev, n)
       
  1173             ui.write("\n")
  1166 
  1174 
  1167 def parents(ui, repo, rev=None):
  1175 def parents(ui, repo, rev=None):
  1168     """show the parents of the working dir or revision"""
  1176     """show the parents of the working dir or revision"""
  1169     if rev:
  1177     if rev:
  1170         p = repo.changelog.parents(repo.lookup(rev))
  1178         p = repo.changelog.parents(repo.lookup(rev))
  1639         (import_,
  1647         (import_,
  1640          [('p', 'strip', 1, 'path strip'),
  1648          [('p', 'strip', 1, 'path strip'),
  1641           ('f', 'force', None, 'skip check for outstanding changes'),
  1649           ('f', 'force', None, 'skip check for outstanding changes'),
  1642           ('b', 'base', "", 'base path')],
  1650           ('b', 'base', "", 'base path')],
  1643          "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
  1651          "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
  1644     "incoming|in": (incoming, [], 'hg incoming [SOURCE]'),
  1652     "incoming|in": (incoming, 
       
  1653          [('p', 'patch', None, 'show patch')],
       
  1654          'hg incoming [-p] [SOURCE]'),
  1645     "^init": (init, [], 'hg init [DEST]'),
  1655     "^init": (init, [], 'hg init [DEST]'),
  1646     "locate":
  1656     "locate":
  1647         (locate,
  1657         (locate,
  1648          [('r', 'rev', '', 'revision'),
  1658          [('r', 'rev', '', 'revision'),
  1649           ('0', 'print0', None, 'end filenames with NUL'),
  1659           ('0', 'print0', None, 'end filenames with NUL'),
  1657           ('X', 'exclude', [], 'exclude path from search'),
  1667           ('X', 'exclude', [], 'exclude path from search'),
  1658           ('r', 'rev', [], 'revision'),
  1668           ('r', 'rev', [], 'revision'),
  1659           ('p', 'patch', None, 'show patch')],
  1669           ('p', 'patch', None, 'show patch')],
  1660          'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
  1670          'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
  1661     "manifest": (manifest, [], 'hg manifest [REV]'),
  1671     "manifest": (manifest, [], 'hg manifest [REV]'),
  1662     "outgoing|out": (outgoing, [], 'hg outgoing [DEST]'),
  1672     "outgoing|out": (outgoing, 
       
  1673          [('p', 'patch', None, 'show patch')],
       
  1674          'hg outgoing [-p] [DEST]'),
  1663     "parents": (parents, [], 'hg parents [REV]'),
  1675     "parents": (parents, [], 'hg parents [REV]'),
  1664     "paths": (paths, [], 'hg paths [NAME]'),
  1676     "paths": (paths, [], 'hg paths [NAME]'),
  1665     "^pull":
  1677     "^pull":
  1666         (pull,
  1678         (pull,
  1667          [('u', 'update', None, 'update working directory'),
  1679          [('u', 'update', None, 'update working directory'),