Skip to content
Snippets Groups Projects
test-absorb.t 9.37 KiB
  $ cat >> $HGRCPATH << EOF
  > [extensions]
  > absorb=
  > EOF

  $ sedi() { # workaround check-code
  > pattern="$1"
  > shift
  > for i in "$@"; do
  >     sed "$pattern" "$i" > "$i".tmp
  >     mv "$i".tmp "$i"
  > done
  > }

  $ hg init repo1
  $ cd repo1

Do not crash with empty repo:

  $ hg absorb
  abort: no mutable changeset to change
  [255]

Make some commits:

  $ for i in 1 2 3 4 5; do
  >   echo $i >> a
  >   hg commit -A a -m "commit $i" -q
  > done

  $ hg annotate a
  0: 1
  1: 2
  2: 3
  3: 4
  4: 5

Change a few lines:

  $ cat > a <<EOF
  > 1a
  > 2b
  > 3
  > 4d
  > 5e
  > EOF

Preview absorb changes:

  $ hg absorb --print-changes --dry-run
  showing changes for a
          @@ -0,2 +0,2 @@
  4ec16f8 -1
  5c5f952 -2
  4ec16f8 +1a
  5c5f952 +2b
          @@ -3,2 +3,2 @@
  ad8b8b7 -4
  4f55fa6 -5
  ad8b8b7 +4d
  4f55fa6 +5e
  
  4 changesets affected
  4f55fa6 commit 5
  ad8b8b7 commit 4
  5c5f952 commit 2
  4ec16f8 commit 1

Run absorb: