equal
deleted
inserted
replaced
25 from mercurial.i18n import _ |
25 from mercurial.i18n import _ |
26 from mercurial.pycompat import open |
26 from mercurial.pycompat import open |
27 from mercurial.node import ( |
27 from mercurial.node import ( |
28 bin, |
28 bin, |
29 hex, |
29 hex, |
30 nullhex, |
30 sha1nodeconstants, |
31 nullid, |
|
32 ) |
31 ) |
33 from mercurial import ( |
32 from mercurial import ( |
34 bookmarks, |
33 bookmarks, |
35 context, |
34 context, |
36 error, |
35 error, |
158 self.ui.warn(_(b'invalid tag entry: "%s"\n') % line) |
157 self.ui.warn(_(b'invalid tag entry: "%s"\n') % line) |
159 fp.write(b'%s\n' % line) # Bogus, but keep for hash stability |
158 fp.write(b'%s\n' % line) # Bogus, but keep for hash stability |
160 continue |
159 continue |
161 revid = revmap.get(source.lookuprev(s[0])) |
160 revid = revmap.get(source.lookuprev(s[0])) |
162 if not revid: |
161 if not revid: |
163 if s[0] == nullhex: |
162 if s[0] == sha1nodeconstants.nullhex: |
164 revid = s[0] |
163 revid = s[0] |
165 else: |
164 else: |
166 # missing, but keep for hash stability |
165 # missing, but keep for hash stability |
167 self.ui.warn(_(b'missing tag entry: "%s"\n') % line) |
166 self.ui.warn(_(b'missing tag entry: "%s"\n') % line) |
168 fp.write(b'%s\n' % line) |
167 fp.write(b'%s\n' % line) |
177 if len(s) != 2: |
176 if len(s) != 2: |
178 continue |
177 continue |
179 |
178 |
180 revid = s[0] |
179 revid = s[0] |
181 subpath = s[1] |
180 subpath = s[1] |
182 if revid != nullhex: |
181 if revid != sha1nodeconstants.nullhex: |
183 revmap = self.subrevmaps.get(subpath) |
182 revmap = self.subrevmaps.get(subpath) |
184 if revmap is None: |
183 if revmap is None: |
185 revmap = mapfile( |
184 revmap = mapfile( |
186 self.ui, self.repo.wjoin(subpath, b'.hg/shamap') |
185 self.ui, self.repo.wjoin(subpath, b'.hg/shamap') |
187 ) |
186 ) |
302 if self.filemapmode and nparents == 1: |
301 if self.filemapmode and nparents == 1: |
303 m1node = self.repo.changelog.read(bin(parents[0]))[0] |
302 m1node = self.repo.changelog.read(bin(parents[0]))[0] |
304 parent = parents[0] |
303 parent = parents[0] |
305 |
304 |
306 if len(parents) < 2: |
305 if len(parents) < 2: |
307 parents.append(nullid) |
306 parents.append(self.repo.nullid) |
308 if len(parents) < 2: |
307 if len(parents) < 2: |
309 parents.append(nullid) |
308 parents.append(self.repo.nullid) |
310 p2 = parents.pop(0) |
309 p2 = parents.pop(0) |
311 |
310 |
312 text = commit.desc |
311 text = commit.desc |
313 |
312 |
314 sha1s = re.findall(sha1re, text) |
313 sha1s = re.findall(sha1re, text) |
354 while parents: |
353 while parents: |
355 p1 = p2 |
354 p1 = p2 |
356 p2 = parents.pop(0) |
355 p2 = parents.pop(0) |
357 p1ctx = self.repo[p1] |
356 p1ctx = self.repo[p1] |
358 p2ctx = None |
357 p2ctx = None |
359 if p2 != nullid: |
358 if p2 != self.repo.nullid: |
360 p2ctx = self.repo[p2] |
359 p2ctx = self.repo[p2] |
361 fileset = set(files) |
360 fileset = set(files) |
362 if full: |
361 if full: |
363 fileset.update(self.repo[p1]) |
362 fileset.update(self.repo[p1]) |
364 fileset.update(self.repo[p2]) |
363 fileset.update(self.repo[p2]) |
419 return parent |
418 return parent |
420 return p2 |
419 return p2 |
421 |
420 |
422 def puttags(self, tags): |
421 def puttags(self, tags): |
423 tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True) |
422 tagparent = self.repo.branchtip(self.tagsbranch, ignoremissing=True) |
424 tagparent = tagparent or nullid |
423 tagparent = tagparent or self.repo.nullid |
425 |
424 |
426 oldlines = set() |
425 oldlines = set() |
427 for branch, heads in pycompat.iteritems(self.repo.branchmap()): |
426 for branch, heads in pycompat.iteritems(self.repo.branchmap()): |
428 for h in heads: |
427 for h in heads: |
429 if b'.hgtags' in self.repo[h]: |
428 if b'.hgtags' in self.repo[h]: |