##// END OF EJS Templates
fetch: use dirstate branch instead of first parents
Sune Foldager -
r7049:6489ee64 default
parent child Browse files
Show More
@@ -33,8 +33,9 b" def fetch(ui, repo, source='default', **"
33 opts['date'] = util.parsedate(date)
33 opts['date'] = util.parsedate(date)
34
34
35 parent, p2 = repo.dirstate.parents()
35 parent, p2 = repo.dirstate.parents()
36 branch = repo[parent].branch()
36 branch = repo.dirstate.branch()
37 if parent != repo[branch].node():
37 branchnode = repo.branchtags().get(branch)
38 if parent != branchnode:
38 raise util.Abort(_('working dir not at branch tip '
39 raise util.Abort(_('working dir not at branch tip '
39 '(use "hg update" to check out branch tip)'))
40 '(use "hg update" to check out branch tip)'))
40
41
@@ -156,4 +156,17 b" echo '% parent should be 3 (fetch did no"
156 hg -R n2 parents --template '{rev}\n'
156 hg -R n2 parents --template '{rev}\n'
157 rm -fr n1 n2
157 rm -fr n1 n2
158
158
159 echo % pull in change on different branch than dirstate
160 hg init n1
161 echo a > n1/a
162 hg -R n1 ci -Am initial
163 hg clone n1 n2
164 echo b > n1/a
165 hg -R n1 ci -m next
166 hg -R n2 branch topic
167 hg -R n2 fetch -d '0 0' -m merge n1
168 echo '% parent should be 0 (fetch did not update or merge anything)'
169 hg -R n2 parents --template '{rev}\n'
170 rm -fr n1 n2
171
159 true
172 true
@@ -170,3 +170,11 b' added 3 changesets with 2 changes to 1 f'
170 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
170 not merging with 1 other new branch heads (use "hg heads ." and "hg merge" to merge them)
171 % parent should be 3 (fetch did not merge anything)
171 % parent should be 3 (fetch did not merge anything)
172 3
172 3
173 % pull in change on different branch than dirstate
174 adding a
175 updating working directory
176 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
177 marked working directory as branch topic
178 abort: working dir not at branch tip (use "hg update" to check out branch tip)
179 % parent should be 0 (fetch did not update or merge anything)
180 0
General Comments 0
You need to be logged in to leave comments. Login now