[PATCH 12 of 19] localrepo: don't use raw context when checking for an empty commit

David Schleimer dschleimer at fb.com
Sun Feb 10 17:30:02 CST 2013


# HG changeset patch
# User David Schleimer <dschleimer at fb.com>
# Date 1360330572 28800
# Node ID cb00b77bc8e24c68b5b4df5e484f7c005f12d2d1
# Parent  272e90e44133f13219edd88cf9d3ecbb87886563
localrepo: don't use raw context when checking for an empty commit

This switches one of the cases in the if statement checking for empty
commits to use the commitable context instead of the raw working
context.  The point of this change is that there is now a clear
distinction between the part of localrepo.commit() where we are
operating on the raw context and the part where we are operating on
the commitable context.  This is turn will make it proactical for
future patches to split up the function.

This is part of a larger refactoring effort to make memctx more
useful, and make it easier to smoothly commit in memory.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1204,7 +1204,7 @@
 
             if (not force and not extra.get("close") and not merge
                 and not cctx.files()
-                and wctx.branch() == wctx.p1().branch()):
+                and cctx.branch() == cctx.p1().branch()):
                 return None
 
             if merge and cctx.deleted():


More information about the Mercurial-devel mailing list