Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
RQL
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
RQL
Commits
9d0f53bac016
Commit
9d0f53bac016
authored
13 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
new undo_modification context manager on select nodes
parent
23ae480e4e43
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stmts.py
+10
-0
10 additions, 0 deletions
stmts.py
with
10 additions
and
0 deletions
stmts.py
+
10
−
0
View file @
9d0f53ba
...
...
@@ -48,6 +48,13 @@
raise
AssertionError
(
'
vref %r is not referenced (%r)
'
%
(
vref
,
vref
.
stmt
))
return
True
class
undo_modification
(
object
):
def
__init__
(
self
,
select
):
self
.
select
=
select
def
__enter__
(
self
):
self
.
select
.
save_state
()
def
__exit__
(
self
):
self
.
select
.
recover
()
class
ScopeNode
(
BaseNode
):
solutions
=
()
# list of possibles solutions for used variables
...
...
@@ -355,6 +362,9 @@
def
should_register_op
(
self
):
return
self
.
memorizing
and
not
self
.
undoing
def
undo_modification
(
self
):
return
undo_modification
(
self
)
def
save_state
(
self
):
"""
save the current tree
"""
self
.
undo_manager
.
push_state
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment