merge: add a files method to the mergestate class

This will be used in the upcoming shelve extension.
util: rename ct variable in makedate to timestamp
util: add an optional timestamp parameter to makedate

This will be used by the upcoming shelve extension.
filectx: refactor filectx.rev() to use filectx._changeid

The code in filectx.rev() was identical to filectx._changeid. Fixing this
allows alternative filectx implementations to only override _changeid.

--HG--
extra : rebase_source : 365d32256d416a3ce958d9ada1a2033c6fa008f1
bundle: refactor changegroup prune to be its own function

Moving the prune function to be a non-nested function allows extensions to
control which revisions are allowed in the changegroup. For example, in my
shallow repo extension I want to prevent filelogs from being added to the
bundle.

This also allows an extension to use a filelog implementation that doesn't
have revlog.linkrev implemented.

--HG--
extra : rebase_source : 55b53c2eee9a5ad73bc924e4a1db8d8f607bda9b
log: move log file walk to its own function

This moves the logic that determines which changesets to process during a
'hg log foo.txt' command. Putting it in its own function allows extensions
to modify how the file log is traversed. For instance, the current
implementation uses filelog revs heavily. Other implementations may not have
filelog revs available.

The function throws an exception if the traversal is not possible via the
filelog, so the parent function can do things the slow way if necessary
(by walking the entire commit history).

Aside from the exception throwing, no logic is changed.

--HG--
extra : rebase_source : e289927e02ffd2c4c787bb6ca737154fbfb92120
changegroup: move changegroup file adding to a separate function

Moving the logic that adds files to a changegroup to a different function
allows extensions to override it and customize the way filelogs are added
to changegroups.

No logic is changed.

--HG--
extra : rebase_source : ca4178c054bcf6aab79994834a6b532938a15fd5
annotate: simplify annotate parent function

The annotate algorithm used a custom parents() function to try to reuse
filectx and filelogs. I simplified it a bit to rely more heavily on the
self.parents() which makes it work well with alternative filectx
implementations. I tested performance on a file with 5000+ revisions
but no renames, and on a file with 500 revisions repeating a series of
4 edits+renames and saw zero performance hit.  In fact, it was reliably a
couple milliseconds faster now.

Added the perfannotate command to contrib/perf.py for future use.

--HG--
extra : rebase_source : 8306089bd18c508c2a5be99de8958a15d4884f98