Add hg incoming command for local repositories
authormpm@selenic.com
Tue, 16 Aug 2005 19:17:16 -0800
changeset 927 5a830d7bea52
parent 926 b765e970c9ff
child 928 6f2c3bcbfaaf
Add hg incoming command for local repositories
mercurial/commands.py
--- a/mercurial/commands.py	Tue Aug 16 19:17:01 2005 -0800
+++ b/mercurial/commands.py	Tue Aug 16 19:17:16 2005 -0800
@@ -782,6 +782,20 @@
             addremove(ui, repo, *files)
         repo.commit(files, message, user)
 
+def incoming(ui, repo, source="default"):
+    """show changesets not found in source"""
+    source = ui.expandpath(source)
+    other = hg.repository(ui, source)
+    if not other.local():
+        ui.warn("abort: incoming doesn't work for remote"
+                + " repositories yet, sorry!\n")
+        return 1
+    o = repo.findincoming(other)
+    o = other.newer(o)
+    o.reverse()
+    for n in o:
+        show_changeset(ui, other, changenode=n)
+
 def init(ui, dest="."):
     """create a new repository in the given directory"""
     if not os.path.exists(dest):
@@ -1303,6 +1317,7 @@
          [('p', 'strip', 1, 'path strip'),
           ('b', 'base', "", 'base path')],
          "hg import [-p NUM] [-b BASE] PATCH..."),
+    "incoming": (incoming, [], 'hg incoming [SOURCE]'),
     "^init": (init, [], 'hg init [DEST]'),
     "locate":
         (locate,