summaryrefslogtreecommitdiff
path: root/README
blob: 08edcd621b1f9015499f934f6d76e8317f037524 (plain)
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
This document includes 3 sections.
1. Migrating a repo, for the initial migration process.
2. Moving things around the repo (if things were moved around your repo).
3. Updating an already migrated repo, if you svn repo has been updated and you'd like to sync git with it.

############### Migrating a repo #######################

If you want to migrate a repository to Git:

* Adjust DEVS_PATH in rename_authors.sh and rename_authors_manual.sh to your setup

* Check out the project - make sure you are checking out the root dir
> git svn clone --use-log-author http://svn.enlightenment.org/svn/e/trunk/PROTO/project project

* In the git repo directory:

* Optional: Move things around the repo (see "Moving things around" section) - look inside the section for explanation on how to check.

* Optional (2): Limit the repo to a subdirectory of interest
git filter-branch --prune-empty -f --subdirectory-filter some/subdirectory

* Transform the authors (script should be shared with attribute patch-by)
> git filter-branch -f --env-filter 'eval $(/path/to/migration/rename_authors.sh)' HEAD

* Attribute Patch by: 
>  git filter-branch -f --env-filter 'eval $(/path/to/migration/rename_patch_by.sh)' HEAD

* Check if there are any anomalies (picked up through incorrect use of Signed-off-by or From lines)
> git shortlog -n -s -e

* Add those authors + email to the manual-reset-author file and reset these
> git filter-branch -f --env-filter 'eval $(/path/to/migration/rename_authors_manual.sh)' HEAD

* Verify all authors check out okay
> git shortlog -n -s -e

* Beautify the SVN revisions in the log
> git filter-branch -f --msg-filter 'sed -e "s/git-svn-id: [^@]*@\([0-9]*\) .*/SVN revision: \1/"' HEAD

* Add the new remote
> git remote add origin ssh://git@git.enlightenment.org/devs/name/project.git

* Push to Git
> git push origin master

####### Optional: Moving things around #####################

This section is for you if you have a directory that has been moved around a repo and you'd like to keep all of it's history.

* Find all the location of a directory.
1. Choose a file that you think is unique to the directory (not the directory itself!), e.g configure.ac.
2. Run:
> git log --follow --name-only -- path/to/current/configure.ac
3. Scroll down to the end to make sure the last commit actually introduced that directory (first commit).
4. Run:
> git log --name-only --format=format: --follow trunk/expedite/configure.ac | sort | uniq
5. Filter the last output manually to make sure it only includes your project and didn't pick up similar directories.

* Write a script similar to filter_branch_scripts/filter-branch-e.sh, copying everything to "newroot".

* Optional but recommended: Mount /tmp/ram on ram or other fast media, and mkdir a "filter" directory there.
> sudo mount ramfs -t ramfs /tmp/ram
> mkdir /tmp/ram/filter

* Run the script you created to move things to newroot.
> git filter-branch -f -d /tmp/ram/filter --prune-empty --tree-filter "$(pwd)/filter_branch_scripts/filter-branch-YOUR-SCRIPT.sh HEAD

* At this point you might need to reset the state of the repo:
> git reset --hard HEAD.

* Filter the repo to include only the new root
> git filter-branch --prune-empty -f --subdirectory-filter newroot

########## Updating a migrated repo #########################

* Check the latest SVN rev imported and clone the branch/trunk from there:
> git svn clone -r 83370:HEAD --use-log-author http://svn.enlightenment.org/svn/e/trunk/efl/ efl-trunk-update

# Until mentioned otherwise, the rest is the same as migrating:

* Transform the authors
> git filter-branch -f --env-filter 'eval $(/full/path/here/rename_authors.sh)' HEAD

* Attribute Patch by: 
>  git filter-branch -f --env-filter 'eval $(/full/path/here/rename_patch_by.sh)' HEAD

* Check if there are any anomalies (picked up through incorrect use of Signed-off-by or From lines)
> git shortlog -n -s -e

* Add those authors + email to the manual-reset-author file and reset these
> git filter-branch -f --env-filter 'eval $(/full/path/here/rename_authors_manual.sh)' HEAD

* Verify all authors check out okay
> git shortlog -n -s -e

* Beautify the SVN revisions in the log
> git filter-branch -f --msg-filter 'sed -e "s/git-svn-id: [^@]*@\([0-9]*\) .*/SVN revision: \1/"' HEAD

# Here comes the interesting part.

* Add the master repo as a remote and fetch
> git remote add origin ssh://git@git.enlightenment.org/core/efl.git
> git fetch origin 

* Find the git revisions that are links (origin/master and one very early commit in master) and reestablish correct ancestory
> gitk master origin/master
> echo commit parent > .git/info/grafts
> gitk master origin/master

* Make sure you like the result, otherwise modify things as needed.

* Make the graft permanent
> git filter-branch --prune-empty -f origin/master..HEAD
> rm .git/info/grafts

* Make sure everything is correct.
> gitk master

* Push to origin (disabling mailhook and etc. if you have them, first)
> git push origin master