1. Luke Plant
  2. histedit

Commits

Patrick Mézard  committed 67c1033

Add --rev option to pass revisions as negative offsets

  • Participants
  • Parent commits 04eafdb
  • Branches default

Comments (0)

Files changed (3)

File __init__.py

View file
 def histedit(ui, repo, *parent, **opts):
     """hg histedit <parent>
     """
+    parent = list(parent) + opts.get('rev', [])
     if opts.get('outgoing'):
         if len(parent) > 1:
             raise util.Abort('only one repo argument allowed with --outgoing')
           ('', 'abort', False, 'abort an edit in progress', ),
           ('o', 'outgoing', False, 'changesets not found in destination'),
           ('f', 'force', False, 'force outgoing even for unrelated repositories'),
+          ('r', 'rev', [], _('first revision to be edited')),
           ],
          __doc__,
          ),

File tests/test-histedit-commute

View file
 }
 
 initrepo
-echo % help text
-hg help histedit
 
 echo % log before edit
 hg log --graph
 EOF
 HGEDITOR="cat $EDITED > " hg histedit bfe4a5a76b37 --keep 2>&1 | fixbundle
 hg log --graph
+
+echo '% try with --rev'
+cat > $EDITED <<EOF
+pick 7c6fdd608667 e
+pick 99a62755c625 c
+EOF
+HGEDITOR="cat $EDITED > " hg histedit --rev -2 2>&1 | fixbundle
+hg log --graph

File tests/test-histedit-commute.out

View file
-% help text
-hg histedit Interactive history editing.
-
-Inspired by git rebase --interactive.
-
-
-hg histedit <parent>
-
-options:
-
- -c --continue  continue an edit already in progress
- -k --keep      strip old nodes after edit is complete
-    --abort     abort an edit in progress
- -o --outgoing  changesets not found in destination
- -f --force     force outgoing even for unrelated repositories
-
-use "hg -v help histedit" to show global options
 % log before edit
 @  changeset:   5:652413bf663e
 |  tag:         tip
    date:        Thu Jan 01 00:00:00 1970 +0000
    summary:     a
 
+% try with --rev
+abort: may not use changesets other than the ones listed
+@  changeset:   7:99e266581538
+|  tag:         tip
+|  user:        test
+|  date:        Thu Jan 01 00:00:00 1970 +0000
+|  summary:     e
+|
+o  changeset:   6:5ad36efb0653
+|  parent:      3:c4f52e213402
+|  user:        test
+|  date:        Thu Jan 01 00:00:00 1970 +0000
+|  summary:     c
+|
+| o  changeset:   5:99a62755c625
+| |  user:        test
+| |  date:        Thu Jan 01 00:00:00 1970 +0000
+| |  summary:     c
+| |
+| o  changeset:   4:7c6fdd608667
+|/   user:        test
+|    date:        Thu Jan 01 00:00:00 1970 +0000
+|    summary:     e
+|
+o  changeset:   3:c4f52e213402
+|  user:        test
+|  date:        Thu Jan 01 00:00:00 1970 +0000
+|  summary:     f
+|
+o  changeset:   2:bfe4a5a76b37
+|  user:        test
+|  date:        Thu Jan 01 00:00:00 1970 +0000
+|  summary:     d
+|
+o  changeset:   1:d2ae7f538514
+|  user:        test
+|  date:        Thu Jan 01 00:00:00 1970 +0000
+|  summary:     b
+|
+o  changeset:   0:cb9a9f314b8b
+   user:        test
+   date:        Thu Jan 01 00:00:00 1970 +0000
+   summary:     a
+