This is a simple `rt -i` fix for changes caused by upstream 83b647ce1cec and
976f5a9c1fd2. We probably want to change our template implementation to
de-dup hashes in the future.
Previously, undolog runs for every command, which sometimes adds unwanted
noticeable overhead like `hg status` with a large obsstore. This patch makes
undo smarter to only log commands that actually write things.
This is done by making undolog only run for transactions, updates (legacy
code that does not require a transaction). Tests are changed to reflect
`hg status` does not trigger undolog, and the new code seems to work better
with chg.
Differential Revision: https://phab.mercurial-scm.org/D739
Summary: "hg hide" is the user friendly command for hiding commits
Test Plan: ran tests
Reviewers: #fbhgext, quark
Reviewed By: #fbhgext, quark
Differential Revision: https://phab.mercurial-scm.org/D725
5d45a997d11 in upstream changed rebase to use unfiltered repositories, which
changes the definition of tip in these two tests. Let's update the test output.
Summary:
cmdutil.amend was changed recently to get rid of the redundant commit during
the amend operation. As a result, we need to update the tests which were aware
of the redundant commit. This commit achieves the same.
Note that as a result of the amend behavior change, the dirsync and copytrace
extensions were broken. They will be be fixed in subsequent commits on top of
this commit. For now, the broken tests for these extensions were removed from
the commit. Eventually, I will fold all the fixes together so that revision
history of the tests is not messed up. This is primarily done only to aid the
review.
Test Plan: Ran the test suite after updating the tests.
In interactive mode, disables out of bounds <-,-> notifying the user with text
and a '\a' sound. Friendlier ui messages for when the user selects the current
state with the arrow keys or when trying to undo to a state before we recorded
anything. Hg serve commands generally aren't user executed and simply should be
skipped across when undoing (like unfinished states). The user can always use
--absolute to see them in preview and to undo to them.
Differential Revision: https://phab.mercurial-scm.org/D502
Change preview to just show the delta and connected commits. This means we need
to calculate oldworkingcopyparent and bookmarks diffs. This output will be
cleaner especially for people with a lot of commits in their repo.
Differential Revision: https://phab.mercurial-scm.org/D467
Makes hg undo -i and hg undo -p output show an "undo to time, before command"
message and adds directions (left, right, return, q). Also adds pager check as
pager break interactiveui.
Testing: run hg undo -p and hg undo -i and see output
Differential Revision: https://phab.mercurial-scm.org/D448
Obsoleted commits may be visible. To make sure that they are un-obsoleted after
undo when appropriate, we add "draft() & obsolete()" recording. The most common
case where this matters is undoing a mid stack amend.
Differential Revision: https://phab.mercurial-scm.org/D438
Instead of the _showstats output from hg.py, we now output the args and time of
the mercurial command we are undoing.
Differential Revision: https://phab.mercurial-scm.org/D412
hg rebase, histedit, unshelve and other commands may stop in an unfinished state
because of merge conflicts or other reasons. The user then has the ability to
continue or abort. Undoing in this case is slightly tricky as for example
aborting a rebase will perform real strips and so undo will fail with an error.
This change still records these states, but flags them as unfinished and skips
over them when undoing and redoing. Hg undo --absolute does not ignore these
states in the really unlikely situation you want to go to one of them.
Differential Revision: https://phab.mercurial-scm.org/D410
Undo commands where undo wasn't first, for example `hg --pager=off undo` break
multiple things, including hg redo. This change fixes this.
Differential Revision: https://phab.mercurial-scm.org/D396
Adds --branch handling to the no argument redo. Also adds better branch testing
and takes a more sensible approach to an undo after an undo --branch.
Redo now restores undoredo.i's --branch field. Undo after a undo --branch is
now an absolute undo. See test cases.
Test Plan:
unit
Differential Revision: https://phab.mercurial-scm.org/D324
Strips docs of unnescerary info and sticks complex things behind --verbose flag.
In most cases hg undo and redo or hg undo --preview should be enough for the
user. Also changes --index to --step, which seems clearer.
Differential Revision: https://phab.mercurial-scm.org/D287
Changes redo to straight up undo the previous undo. This is a bit trickier than
it may seem. The previous redo capabilities are still covered in hg undo as
--index accepts negative numbers allowing you to step both forward and
backwards one step at a time. The new redo reads the linear undo log to find
out where to undo to while updating the undo/redo index allowing you to continue
from where you left off.
Differential Revision: https://phab.mercurial-scm.org/D286
Adds --index handling for --preview. With the added handling, preview also
works for redo. In order to bypass template logic, we simply change the
"undoredo.i" file and reset it afterwards.
Differential Revision: https://phab.mercurial-scm.org/D207
Allows for hg undo --preview to see smartlog like preview of what undo will do.
This will be neccesery before a general roll-out so users can see what undo will
do. This first iteration only shows what "hg undo" will do, not redo and not
--index.
Differential Revision: https://phab.mercurial-scm.org/D206
Summary: Before this `test-check-code-hg.t` failed on `undo`-related things.
Test Plan: - rt
Reviewers: felixmerk, #fbhgext
Differential Revision: https://phab.mercurial-scm.org/D226
Adds smart indexing to localbranch undoes. This eliminates the mental burden of
the user of keeping track in what order and when changes where made. Drawback
is that it raises the computational complexity from the number of draft
commits to draft commits times how many repo states you are undoing. Common use
case should be to undo a small number of changes, so this is acceptable.
hg undo -b changectx finds the closest pertinent change and undoes that. -b
with -n is not supported. The reason it is not supported is that local branch
level undoes are delta specific and not state specific, which in essence means
that running hg undo -b # twice is not guaranteed to give you the same resault
as running hg undo -b # -n 2. We could run -b multiple times for a -n, but the
cost of a -b increases with a larger -n (which isn't the case for a standard
undo), and abort handling would be more complicated (I'm not sure how well we
can roll back a tree of obs markers?). In essence -n with -b is not that
usefull a feature (bc perf limits) and would potentially require a decently large
amount of time to implement correctly.
Also adds redo -b since this command now makes a lot more sense when we use the
smarter indexing. Adds logic to seperate undoes and redoes in different
branches. You can perform relative undoes and redoes within the latest scope,
while undoes and redoes within a new scope will start at the present (absolute)
state.
Differential Revision: https://phab.mercurial-scm.org/D186
Add the ability to undo changes within one 'localbranch'. In the future, this
will probably become default behavior. Undo -b changecontext will undo changes
belonging to the local branch identified by the changecontext (see revset
localbranch). Based on obs markers we can identify connected commits that we
in turn reveal or hide outside of this localbranch. This undo allows users to
work on multiple branches independantly.
Currently, indexing for undoes is still on the repo level. This isn't good
from a ux experience. Next up would be localbranch level indexing logic and
redo logic.
Differential Revision: https://phab.mercurial-scm.org/D160
Adds localbranch revset to be used for localbranch undos. A localbranch is a
set of draft commits that are connected via draft commits. Any draft commit
within a branch, or a public commit at the base of the branch, can be passed as
an argument to localbranch(). This will be necessary for selecting the scope
for a localbranch undo. Also fixes oldraft() output when used with other
revsets. Previously olddraft() would ignore operators such as and because of a
missing the necessary handling.
Differential Revision: https://phab.mercurial-scm.org/D159
Basic file corruption handling: if file is corrupted, we nuke our history.
Downside is that we won't be able to undo furter back in case of a corruption,
but considering corruption this is expected.
Differential Revision: https://phab.mercurial-scm.org/D111
Makes obs markers for undos more meaningful. When an undo performs a strict one
to one change, the written obs marker reflects that and the user even gets a
helpful ui message in smartlog. One to many undos do not support such obs
markers (currently) because we can't tell splits and divergence apart easily.
Differential Revision: https://phab.mercurial-scm.org/D108
Allow user to keep working copy changes after undo, mimicking unamend and
uncommit behavior. As discussed at the team lunch, this allows undo to remain
ignorant of what command the user has run while conforming to user expectations.
In the future this could be done in a smarter way where we properly restore hg
status dynamically.
Differential Revision: https://phab.mercurial-scm.org/D55
Prevents users from accidentally crossing gaps in their history and adds an
overwride. In most cases undoing across a gap isn't desired as the connection
between the pre and post states is unkown. While undoing across a gap is not
destructive or inherently risky, it is inherently confusing to the user since
we don't know how many and what commands where run. Furthermore, there is no
guarantee that the pre and post states of a gap are actually connected in any
sane way.
Differential Revision: https://phab.mercurial-scm.org/D53
Implements, and makes default relative undos and adds redos. A relative undo
behaves differently only if you haven't performend any repo changing operations
since your previous undo or redo, in which case you operate relative to that
undo/redo. This means that a second undo will not undo the previous undo but
instead bring you furter back.
Differential Revision: https://phab.mercurial-scm.org/D52
Adds undo command that changes working copy parent, bookmarks and
visible draft commits to a previous repo state.
Differential Revision: https://phab.mercurial-scm.org/D51
Summary:
I haven't tracked down where this change came from, but it looks fairly
benign and straightforward to fix.
Test Plan: The test now passes
Reviewers: #fbhgext, stash
Reviewed By: #fbhgext, stash
Differential Revision: https://phab.mercurial-scm.org/D147
The upstream has added some warning around repo.svfs/vfs write operations
without taking locks. For undo, we don't want to take the repo lock (since
that means read-only operations like `hg log` will be blocked by another
`hg commit`). So undo has its own locking and own transaction (for lower
overhead). Therefore move all files we may write (including lock and
transaction files) to `.hg/undolog` and whitelist the directory at
`localrepository._wlockfreeprefix` to bypass the checks.
Differential Revision: https://phab.mercurial-scm.org/D112
Implements lighttransaction(repo) which improves performance of hg undo and
prevents infinite loops caused by hooks that run true hg commands. Also adds
_getrevlog and _invertindex commands, factoring out code that will be reused.
Changes output for gaps when typing hg debugundohistory -l for slightly
better ui and clearer testing. Lastly, changes lock from repo lock to new
undolog lock and tests this. In the future, with some changes to undo.log,
we may be able to take the lock later, bypassing the need to take it for
read-only operations.
Differential Revision: https://phab.mercurial-scm.org/D50
Summary: Looks like the upstream has changed it on us.
Reviewers: quark
Reviewed By: quark
Subscribers: quark
Differential Revision: https://phab.mercurial-scm.org/D40
Summary:
Makes sure repo is filtered by the "visible" filter which hides hidden commits.
Otherwise --hidden flag can mass up "draftheads" storage.
Test Plan: Added a new test case.
Reviewers: #mercurial, quark
Reviewed By: quark
Subscribers: quark, medson, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D5357222
Tasks: 19822306
Signature: t1:5357222:1499102417:ce78065d36841601fe0dfb1d615d7b3be28c5870
Summary: amend performs two transactions, second without command which breaks our assertion, but possibly isn't an issue. This fixes the assertion.
Test Plan: unit tests
Reviewers: #mercurial, stash, quark
Reviewed By: quark
Subscribers: quark, stash, medson, mjpieters
Differential Revision: https://phabricator.intern.facebook.com/D5326358
Tasks: 19261492
Signature: t1:5326358:1498684945:0fde1df243cdbac67ceb092d30599ebd56a731a5