Source

hg-importfs / test-importfs.t

Full commit
Load the extension:

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "importfs = $TESTDIR/importfs.py" >> $HGRCPATH

Provoke an error by using a non existent directory for import:

  $ hg importfs d1 r
  abort: directory d1 does not exist
  [255]

Create a simple filesystem structure for import:

  $ mkdir d1
  $ echo "c1" > d1/f1
  $ echo "c2" > d1/f2
  $ mkdir d1/d2
  $ echo "c3" > d1/d2/f3
  $ mkdir d1/d3
  $ echo "c4" > d1/d3/f4
  $ echo "c5" > d1/d3/f5

Provoke an error by using the rev option without the branch option:

  $ hg importfs -r 1 d1 r
  abort: you specified a revision without giving a branch name
  [255]

Perform the first import (creates a new repository):

  $ hg importfs d1 r
  created repository $TESTTMP/r
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  adding d2/f3
  adding d3/f4
  adding d3/f5
  adding f1
  adding f2

Add a new file to the filesystem structure:

  $ echo "c6" > d1/d2/f6

Perform the second import (uses the repository created before):

  $ hg importfs d1 r -t t1 -m 'm1'
  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
  adding d2/f6

Show the log of the last changeset:

  $ hg -R r log -vr 1
  changeset:   1:???????????? (glob)
  tag:         t1
  user:        test
  date:        ??? ??? ?? ??:??:?? ???? +???? (glob)
  files:       d2/f6
  description:
  m1
  
  

Change the filesystem structure (add, modify, delete):

  $ echo "c7" > d1/d2/f7
  $ echo "c8" > d1/d3/f4
  $ rm d1/d3/f5

Perform a third import using a branch:

  $ hg importfs -b b1 -r 0 -t t2 d1 r
  0 files updated, 0 files merged, 2 files removed, 0 files unresolved
  marked working directory as branch b1
  adding d2/f6
  adding d2/f7
  removing d3/f5

Show the log of the last changeset:

  $ hg -R r log -vr 3
  changeset:   3:???????????? (glob)
  branch:      b1
  tag:         t2
  parent:      0:???????????? (glob)
  user:        test
  date:        ??? ??? ?? ??:??:?? ???? +???? (glob)
  files:       d2/f6 d2/f7 d3/f4 d3/f5
  description:
  importfs commit.
  
  
Commit the same files on top of the default branch:

  $ hg importfs d1 r
  3 files updated, 0 files merged, 1 files removed, 0 files unresolved
  adding d2/f7
  removing d3/f5

Show the log of the last changeset:

  $ hg -R r log -vr 5
  changeset:   5:???????????? (glob)
  tag:         tip
  parent:      2:???????????? (glob)
  user:        test
  date:        ??? ??? ?? ??:??:?? ???? +???? (glob)
  files:       d2/f7 d3/f4 d3/f5
  description:
  importfs commit.
  
  
Add a new file to the filesystem structure:

  $ echo "c9" > d1/d3/f8

Reuse the branch:

  $ hg importfs -b b1 d1 r
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
  adding d3/f8

Show the log of the last changeset:

  $ hg -R r log -vr 6
  changeset:   6:???????????? (glob)
  branch:      b1
  tag:         tip
  parent:      4:???????????? (glob)
  user:        test
  date:        ??? ??? ?? ??:??:?? ???? +???? (glob)
  files:       d3/f8
  description:
  importfs commit.