Show More
@@ -678,6 +678,25 class gitsubrepo(object): | |||||
678 | # circumstances |
|
678 | # circumstances | |
679 | return self._gitstate() |
|
679 | return self._gitstate() | |
680 |
|
680 | |||
|
681 | def merge(self, state): | |||
|
682 | source, revision, kind = state | |||
|
683 | self._fetch(source, revision) | |||
|
684 | base = self._gitcommand(['merge-base', revision, | |||
|
685 | self._state[1]]).strip() | |||
|
686 | if base == revision: | |||
|
687 | self.get(state) # fast forward merge | |||
|
688 | elif base != self._state[1]: | |||
|
689 | self._gitcommand(['merge', '--no-commit', revision]) | |||
|
690 | ||||
|
691 | def push(self, force): | |||
|
692 | cmd = ['push'] | |||
|
693 | if force: | |||
|
694 | cmd.append('--force') | |||
|
695 | # as subrepos have no notion of "where to push to" we | |||
|
696 | # assume origin master. This is git's default | |||
|
697 | self._gitcommand(cmd + ['origin', 'master', '-q']) | |||
|
698 | return True | |||
|
699 | ||||
681 | types = { |
|
700 | types = { | |
682 | 'hg': hgsubrepo, |
|
701 | 'hg': hgsubrepo, | |
683 | 'svn': svnsubrepo, |
|
702 | 'svn': svnsubrepo, |
@@ -81,3 +81,93 update to previous substate | |||||
81 | path s |
|
81 | path s | |
82 | source ../gitroot |
|
82 | source ../gitroot | |
83 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 |
|
83 | revision da5f5b1d8ffcf62fb8327bcd3c89a4367a6018e7 | |
|
84 | ||||
|
85 | make $GITROOT pushable, by replacing it with a clone with nothing checked out | |||
|
86 | ||||
|
87 | $ cd .. | |||
|
88 | $ git clone gitroot gitrootbare --bare -q | |||
|
89 | $ rm -rf gitroot | |||
|
90 | $ mv gitrootbare gitroot | |||
|
91 | ||||
|
92 | clone root, make local change | |||
|
93 | ||||
|
94 | $ cd t | |||
|
95 | $ hg clone . ../ta | |||
|
96 | updating to branch default | |||
|
97 | cloning subrepo s | |||
|
98 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
99 | ||||
|
100 | $ cd ../ta | |||
|
101 | $ echo ggg >> s/g | |||
|
102 | $ hg commit -m ggg | |||
|
103 | committing subrepository $TESTTMP/ta/s | |||
|
104 | $ hg debugsub | |||
|
105 | path s | |||
|
106 | source ../gitroot | |||
|
107 | revision 79695940086840c99328513acbe35f90fcd55e57 | |||
|
108 | ||||
|
109 | clone root separately, make different local change | |||
|
110 | ||||
|
111 | $ cd ../t | |||
|
112 | $ hg clone . ../tb | |||
|
113 | updating to branch default | |||
|
114 | cloning subrepo s | |||
|
115 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
116 | ||||
|
117 | $ cd ../tb/s | |||
|
118 | $ echo f > f | |||
|
119 | $ git add f | |||
|
120 | $ cd .. | |||
|
121 | ||||
|
122 | $ hg commit -m f | |||
|
123 | committing subrepository $TESTTMP/tb/s | |||
|
124 | $ hg debugsub | |||
|
125 | path s | |||
|
126 | source ../gitroot | |||
|
127 | revision aa84837ccfbdfedcdcdeeedc309d73e6eb069edc | |||
|
128 | ||||
|
129 | user b push changes | |||
|
130 | ||||
|
131 | $ hg push | |||
|
132 | pushing to $TESTTMP/t | |||
|
133 | searching for changes | |||
|
134 | adding changesets | |||
|
135 | adding manifests | |||
|
136 | adding file changes | |||
|
137 | added 1 changesets with 1 changes to 1 files | |||
|
138 | ||||
|
139 | user a pulls, merges, commits | |||
|
140 | ||||
|
141 | $ cd ../ta | |||
|
142 | $ hg pull | |||
|
143 | pulling from $TESTTMP/t | |||
|
144 | searching for changes | |||
|
145 | adding changesets | |||
|
146 | adding manifests | |||
|
147 | adding file changes | |||
|
148 | added 1 changesets with 1 changes to 1 files (+1 heads) | |||
|
149 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
150 | $ hg merge | |||
|
151 | Automatic merge went well; stopped before committing as requested | |||
|
152 | pulling subrepo s | |||
|
153 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
154 | (branch merge, don't forget to commit) | |||
|
155 | $ cat s/f | |||
|
156 | f | |||
|
157 | $ cat s/g | |||
|
158 | g | |||
|
159 | gg | |||
|
160 | ggg | |||
|
161 | $ hg commit -m 'merge' | |||
|
162 | committing subrepository $TESTTMP/ta/s | |||
|
163 | $ hg debugsub | |||
|
164 | path s | |||
|
165 | source ../gitroot | |||
|
166 | revision f47b465e1bce645dbf37232a00574aa1546ca8d3 | |||
|
167 | $ hg push | |||
|
168 | pushing to $TESTTMP/t | |||
|
169 | searching for changes | |||
|
170 | adding changesets | |||
|
171 | adding manifests | |||
|
172 | adding file changes | |||
|
173 | added 2 changesets with 2 changes to 1 files |
General Comments 0
You need to be logged in to leave comments.
Login now