[PATCH] changelog: document the 'readpending' method
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Sat Jun 20 06:33:14 UTC 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1411960723 25200
# Sun Sep 28 20:18:43 2014 -0700
# Node ID 4ee6cb9d4164b381a98359815eaf615a3e207c7e
# Parent 2748bf78a5bf610da4f2d90fd1eea19a3b360c04
changelog: document the 'readpending' method
I happen to have spend some time understanding this logic, so I'm leaving
documentation for the next poor fellow.
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -257,10 +257,22 @@ class changelog(revlog.revlog):
self._divert = False
# split when we're done
self.checkinlinesize(tr)
def readpending(self, file):
+ """read index data from a "pending" file
+
+ During transaction, the actual changesets' data are still stored in the
+ main file, but are not referenced in the official index. Instead a
+ "pending" index is written by the transaction logic. If this function
+ is running, we are likely in a subprocess invoked in a hook. The
+ subprocess is informed that it is within a transaction and need to
+ access it's content.
+
+ This function will read all the index data out of the pending file and
+ overide the local ones. We just overide a handful of key index related
+ data because everything else is still relevant."""
if not self.opener.exists(file):
return # no pending data for changelog
r = revlog.revlog(self.opener, file)
self.index = r.index
self.nodemap = r.nodemap
More information about the Mercurial-devel
mailing list