[PATCH 2 of 3] commands: document use of 'hg log -fr src:null -P tgt' to emulate incoming for merges

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Mon Nov 17 08:03:03 CST 2008


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1226929671 -3600
# Node ID de2b581e909682318c4c8a7176d2a237d52f7518
# Parent  6cdb6107f3fd3db1656aca2b99ebd47a038bbcd7
commands: document use of 'hg log -fr src:null -P tgt' to emulate incoming for merges

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -993,6 +993,18 @@
     else:
         defrange = '-1:0'
     revs = revrange(repo, opts['rev'] or [defrange])
+
+    # common ancestor is min rev when pruning and following csets
+    prunerevs = [repo.changelog.rev(repo.lookup(rev))
+                 for rev in opts.get('prune', ())]
+    if prunerevs and follow and not pats:
+        followedrev = revs[0]
+        minrev = -1
+        for rev in prunerevs:
+            ancrev = repo.changelog.ancestorrev(followedrev, rev)
+            minrev = max(minrev, ancrev)
+        revs = [r for r in revs if r >= minrev]
+
     wanted = {}
     slowpath = m.anypats() or opts.get('removed')
     fncache = {}
@@ -1104,8 +1116,7 @@
 
     # it might be worthwhile to do this in the iterator if the rev range
     # is descending and the prune args are all within that range
-    for rev in opts.get('prune', ()):
-        rev = repo.changelog.rev(repo.lookup(rev))
+    for rev in prunerevs:
         ff = followfilter()
         stop = min(revs[0], revs[-1])
         for x in xrange(rev, stop-1, -1):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1814,6 +1814,8 @@
     first parent only. Also, the files: list will only reflect files
     that are different from BOTH parents.
 
+    NOTE: 'hg log -fr src:null -P tgt' can be used to log all csets that
+    'hg up tgt; hg merge src' would merge.
     """
 
     get = util.cachefunc(lambda r: repo[r].changeset())


More information about the Mercurial-devel mailing list