Issue26

Title add --no-merges (-M) for log, outgoing, incoming, etc.
Priority feature Status resolved
Superseder Nosy List mpm, tonfa
Assigned To tonfa Topics

Created on 2005-10-23.09:34:43 by mpm, last changed 2005-10-26.23:17:08 by mpm.

Messages
msg32 (view) Author: tonfa Date: 2005-10-23.11:58:11
This "fixes" [issue 17] (log: optionally only show merges (two parents)
or non-merges)

(I don't know if only-merges is the preferred name option, i thought i
could use --merge (m), but it wasn't consistent with --no-merges (M))

# HG changeset patch
# User Benoit Boissinot <benoit.boissinot@ens-lyon.org>
# Node ID f40b2a0270c621a436b8495d2c4237599bc44a41
# Parent  54fe951f46f45545ade79335db231f09a4ff0307
add --only-merges (-m) log

diff -r 54fe951f46f4 -r f40b2a0270c6 mercurial/commands.py
--- a/mercurial/commands.py	Sun Oct 23 13:11:05 2005 +0200
+++ b/mercurial/commands.py	Sun Oct 23 13:54:56 2005 +0200
@@ -1280,6 +1280,8 @@
             parents = [p for p in repo.changelog.parents(changenode)
                        if p != nullid]
             if opts['no_merges'] and len(parents) == 2:
+                 continue
+            if opts['only_merges'] and len(parents) != 2:
                  continue

             br = None
@@ -1900,6 +1902,7 @@
           ('k', 'keyword', [], _('search for a keyword')),
           ('r', 'rev', [], _('revision')),
           ('M', 'no-merges', None, _("do not show merges")),
+          ('m', 'only-merges', None, _("show only merges")),
           ('p', 'patch', None, _('show patch'))],
          _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
     "manifest": (manifest, [], _('hg manifest [REV]')),
msg31 (view) Author: tonfa Date: 2005-10-23.11:17:53
I couldn't find it, here is a new patch:

# HG changeset patch
# User Benoit Boissinot <benoit.boissinot@ens-lyon.org>
# Node ID 54fe951f46f45545ade79335db231f09a4ff0307
# Parent  8fc2ad2f274d7ed29996a9b56be2852191d73f27
add --no-merges (-M) for log, outgoing, incoming

diff -r 8fc2ad2f274d -r 54fe951f46f4 mercurial/commands.py
--- a/mercurial/commands.py	Sat Oct 22 23:22:39 2005 +0200
+++ b/mercurial/commands.py	Sun Oct 23 13:11:05 2005 +0200
@@ -1214,9 +1214,12 @@
         return
     o = other.newer(o)
     for n in o:
+        parents = [p for p in other.changelog.parents(n) if p != nullid]
+        if opts['no_merges'] and len(parents) == 2:
+            continue
         show_changeset(ui, other, changenode=n)
         if opts['patch']:
-            prev = other.changelog.parents(n)[0]
+            prev = (parents and parents[0]) or nullid
             dodiff(ui, ui, other, prev, n)
             ui.write("\n")

@@ -1273,6 +1276,12 @@
             du = dui(ui)
         elif st == 'add':
             du.bump(rev)
+            changenode = repo.changelog.node(rev)
+            parents = [p for p in repo.changelog.parents(changenode)
+                       if p != nullid]
+            if opts['no_merges'] and len(parents) == 2:
+                 continue
+
             br = None
             if opts['keyword']:
                 changes = repo.changelog.read(repo.changelog.node(rev))
@@ -1291,8 +1300,7 @@

             show_changeset(du, repo, rev, brinfo=br)
             if opts['patch']:
-                changenode = repo.changelog.node(rev)
-                prev, other = repo.changelog.parents(changenode)
+                prev = (parents and parents[0]) or nullid
                 dodiff(du, du, repo, prev, changenode, fns)
                 du.write("\n\n")
         elif st == 'iter':
@@ -1326,9 +1334,12 @@
     o = repo.findoutgoing(other)
     o = repo.newer(o)
     for n in o:
+        parents = [p for p in repo.changelog.parents(n) if p != nullid]
+        if opts['no_merges'] and len(parents) == 2:
+            continue
         show_changeset(ui, repo, changenode=n)
         if opts['patch']:
-            prev = repo.changelog.parents(n)[0]
+            prev = (parents and parents[0]) or nullid
             dodiff(ui, ui, repo, prev, n)
             ui.write("\n")

@@ -1869,7 +1880,8 @@
           ('b', 'base', "", _('base path'))],
          _("hg import [-f] [-p NUM] [-b BASE] PATCH...")),
     "incoming|in": (incoming,
-         [('p', 'patch', None, _('show patch'))],
+         [('M', 'no-merges', None, _("do not show merges")),
+          ('p', 'patch', None, _('show patch'))],
          _('hg incoming [-p] [SOURCE]')),
     "^init": (init, [], _('hg init [DEST]')),
     "locate":
@@ -1887,11 +1899,13 @@
           ('b', 'branch', None, _('show branches')),
           ('k', 'keyword', [], _('search for a keyword')),
           ('r', 'rev', [], _('revision')),
+          ('M', 'no-merges', None, _("do not show merges")),
           ('p', 'patch', None, _('show patch'))],
          _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
     "manifest": (manifest, [], _('hg manifest [REV]')),
     "outgoing|out": (outgoing,
-         [('p', 'patch', None, _('show patch'))],
+         [('M', 'no-merges', None, _("do not show merges")),
+          ('p', 'patch', None, _('show patch'))],
          _('hg outgoing [-p] [DEST]')),
     "parents": (parents, [], _('hg parents [REV]')),
     "paths": (paths, [], _('hg paths [NAME]')),
msg30 (view) Author: mpm Date: 2005-10-23.09:34:43
(I think I may have already seen a patch for this)
History
Date User Action Args
2005-10-26 23:17:08mpmsetstatus: testing -> resolved
nosy: mpm, tonfa
2005-10-24 22:39:28mpmsetstatus: chatting -> testing
nosy: mpm, tonfa
2005-10-23 11:58:11tonfasetnosy: mpm, tonfa
messages: + msg32
2005-10-23 11:29:31tonfasetnosy: + tonfa
assignedto: tonfa
2005-10-23 11:17:53tonfasetstatus: unread -> chatting
messages: + msg31
2005-10-23 09:34:43mpmcreate