1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
Load commonly used test logic
$ . "$TESTDIR/testutil"
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ git tag alpha
$ cd ..
$ hg clone -U gitrepo hgrepo
importing 1 git commits
new changesets ff7a2f2d8d70 (1 drafts)
By default, the Git state isn't preserved across a copying/linking
clone
$ hg clone -U hgrepo otherhgrepo
$ cd otherhgrepo
$ find .hg -name 'git*' | sort
$ hg tags -v
tip 0:ff7a2f2d8d70
$ hg log -r 'fromgit()' -T '{rev}:{node|short} {gitnode|short}\n'
$ cd ..
$ rm -r otherhgrepo
Nor using a pull clone
$ hg clone -U --pull hgrepo otherhgrepo
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
new changesets ff7a2f2d8d70
$ cd otherhgrepo
$ find .hg -name 'git*' | sort
$ hg tags -v
tip 0:ff7a2f2d8d70
$ hg log -r 'fromgit()' -T '{rev}:{node|short} {gitnode|short}\n'
$ cd ..
$ rm -r otherhgrepo
But we can enable it!
$ cat >> $HGRCPATH <<EOF
> [experimental]
> hg-git-serve = yes
> EOF
Check transferring between Mercurial repositories using a
copying/linking clone
$ hg clone -U hgrepo otherhgrepo
$ cd otherhgrepo
$ find .hg -name 'git*' | sort
$ hg tags -q
tip
$ hg log -r 'fromgit()' -T '{rev}:{node|short} {gitnode|short}\n'
$ cd ..
Checking using a pull clone
$ rm -rf otherhgrepo
$ hg clone -U --pull hgrepo otherhgrepo
requesting all changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
new changesets ff7a2f2d8d70
$ cd otherhgrepo
$ hg tags -q
tip
alpha
$ hg log -r 'fromgit()' -T '{rev}:{node|short} {gitnode|short}\n'
0:ff7a2f2d8d70 7eeab2ea75ec
$ cd ..
Can we repopulate the state from a Mercurial repository?
$ cd otherhgrepo
$ hg debug-remove-hggit-state
clearing out the git cache data
$ hg log -qr 'fromgit()'
$ hg tags
tip 0:ff7a2f2d8d70
$ hg pull
pulling from $TESTTMP/hgrepo
searching for changes
no changes found
$ hg log -qr 'fromgit()'
$ hg tags
tip 0:ff7a2f2d8d70
Sadly, no.
|