Commit Graph

10 Commits

Author SHA1 Message Date
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Adam Simpkins
a6782ea273 minor improvements to hg journal output
Summary:
Minor fixes to how the `previous locations of %s` line is printed:
- Start the pager before printing this line, so it gets included in the pager
  output correctly.
- Avoid printing this line when using a custom output template.  Previously it
  was only skipped when using the `json` template.  This now matches the logic
  used to skip the `no recorded locations` line that was recommended in
  D7512030.

Reviewed By: ryanmce

Differential Revision: D7537661

fbshipit-source-id: eb695dd98c06149701cf96acf5ec2eb277ea9cf3
2018-04-13 21:51:48 -07:00
Adam Simpkins
39cd1c0389 fix hg journal to avoid printing non-JSON data with -Tjson
Summary:
Avoid printing "no recorded locations" directly to stdout when a format
template was specified.  In particular this avoids printing non-JSON data
when using `-Tjson`.

We potentially could change this to print to stderr instead.  However for now
I just followed the same pattern of checking the template as was done above for
the "previous locations" message.

Reviewed By: ryanmce

Differential Revision: D7512030

fbshipit-source-id: 2c32f07962fac4ca3d6bfd8f2ca3c4840b2a8a9b
2018-04-13 21:51:48 -07:00
Pierre-Yves David
816a66763b journal: rename on disk files to 'namejournal'
The 'journal' naming is already used by the transaction journal. Having an
unrelated group of file with such a close naming is confusing and error prone.
We rename the file used by the 'journal' extension to use 'namejournal' as the
extension track the location of various 'names'.
2016-08-24 03:59:19 +02:00
Yuya Nishihara
7c8b72638d journal: use fm.formatdate() to pass date tuple in appropriate type (BC) 2016-07-31 17:11:48 +09:00
Yuya Nishihara
431f6e2124 journal: use fm.formatlist() to pass hashes in appropriate type (BC) 2016-07-31 16:56:26 +09:00
Yuya Nishihara
df734a45ca journal: use fm.hexfunc() to get full hash in JSON/template output (BC)
We generally do that.
2016-07-31 16:38:16 +09:00
Martijn Pieters
70f47c8885 journal: add support for seaching by pattern
If a pattern is used, include the entry name in the output, to make it clear
what name was matched.
2016-07-08 16:48:38 +01:00
Martijn Pieters
c699263458 journal: add dirstate tracking
Note that now the default action for `hg journal` is to list the working copy
history, not all bookmarks. In its place is the `--all` switch which lists all
name changes recorded, including the name for which the change was recorded on
each line.

Locking is switched to using a dedicated lock to avoid issues with the dirstate
being written during wlock unlocking (you can't re-lock during that process).
2016-07-11 13:39:24 +01:00
Martijn Pieters
5eddc7a7b3 journal: new experimental extension
Records bookmark locations and shows you where bookmarks were located in the
past.

This is the first in a planned series of locations to be recorded; a future
patch will add working copy (dirstate) tracking, and remote bookmarks will be
supported as well, so the journal storage format should be fairly generic to
support those use-cases.
2016-06-24 16:12:05 +01:00