Show More
@@ -32,9 +32,18 b' class changectx(object):' | |||
|
32 | 32 | self._node = self._repo.lookup(changeid) |
|
33 | 33 | self._rev = self._repo.changelog.rev(self._node) |
|
34 | 34 | |
|
35 | def __str__(self): | |
|
36 | return short(self.node()) | |
|
37 | ||
|
35 | 38 | def __repr__(self): |
|
36 | 39 | return "<changectx %s>" % short(self.node()) |
|
37 | 40 | |
|
41 | def __eq__(self, other): | |
|
42 | return self._rev == other._rev | |
|
43 | ||
|
44 | def __nonzero__(self): | |
|
45 | return self._rev != -1 | |
|
46 | ||
|
38 | 47 | def changeset(self): |
|
39 | 48 | try: |
|
40 | 49 | return self._changeset |
@@ -127,9 +136,18 b' class filectx(object):' | |||
|
127 | 136 | else: |
|
128 | 137 | raise AttributeError, name |
|
129 | 138 | |
|
139 | def __nonzero__(self): | |
|
140 | return self._filerev != nullid | |
|
141 | ||
|
142 | def __str__(self): | |
|
143 | return "%s@%s" % (self.path(), short(self.node())) | |
|
144 | ||
|
130 | 145 | def __repr__(self): |
|
131 | 146 | return "<filectx %s@%s>" % (self.path(), short(self.node())) |
|
132 | 147 | |
|
148 | def __eq__(self, other): | |
|
149 | return self._path == other._path and self._changeid == other._changeid | |
|
150 | ||
|
133 | 151 | def filerev(self): return self._filerev |
|
134 | 152 | def filenode(self): return self._filenode |
|
135 | 153 | def filelog(self): return self._filelog |
@@ -321,6 +321,19 b' class localrepository(repo.repository):' | |||
|
321 | 321 | def changectx(self, changeid=None): |
|
322 | 322 | return context.changectx(self, changeid) |
|
323 | 323 | |
|
324 | def parents(self, changeid=None): | |
|
325 | ''' | |
|
326 | get list of changectxs for parents of changeid or working directory | |
|
327 | ''' | |
|
328 | if changeid is None: | |
|
329 | pl = self.dirstate.parents() | |
|
330 | else: | |
|
331 | n = self.changelog.lookup(changeid) | |
|
332 | pl = self.changelog.parents(n) | |
|
333 | if pl[1] == nullid: | |
|
334 | return [self.changectx(pl[0])] | |
|
335 | return [self.changectx(pl[0]), self.changectx(pl[1])] | |
|
336 | ||
|
324 | 337 | def filectx(self, path, changeid=None, fileid=None): |
|
325 | 338 | """changeid can be a changeset revision, node, or tag. |
|
326 | 339 | fileid can be a file revision or node.""" |
@@ -320,12 +320,12 b' def update(repo, node, branchmerge=False' | |||
|
320 | 320 | |
|
321 | 321 | ### check phase |
|
322 | 322 | |
|
323 |
pl = repo. |
|
|
324 |
if not overwrite and pl |
|
|
323 | pl = repo.parents() | |
|
324 | if not overwrite and len(pl) > 1: | |
|
325 | 325 | raise util.Abort(_("outstanding uncommitted merges")) |
|
326 | 326 | |
|
327 | p1, p2 = pl[0], node | |
|
328 |
pa = |
|
|
327 | p1, p2 = pl[0], repo.changectx(node) | |
|
328 | pa = p1.ancestor(p2) | |
|
329 | 329 | |
|
330 | 330 | # are we going backwards? |
|
331 | 331 | backwards = (pa == p2) |
@@ -345,17 +345,16 b' def update(repo, node, branchmerge=False' | |||
|
345 | 345 | if modified or added or removed: |
|
346 | 346 | raise util.Abort(_("outstanding uncommitted changes")) |
|
347 | 347 | |
|
348 |
m1 = |
|
|
349 |
m2 = |
|
|
350 |
ma = |
|
|
348 | m1 = p1.manifest().copy() | |
|
349 | m2 = p2.manifest().copy() | |
|
350 | ma = pa.manifest() | |
|
351 | 351 | |
|
352 | 352 | # resolve the manifest to determine which files |
|
353 | 353 | # we care about merging |
|
354 | 354 | repo.ui.note(_("resolving manifests\n")) |
|
355 | 355 | repo.ui.debug(_(" overwrite %s branchmerge %s partial %s\n") % |
|
356 | 356 | (overwrite, branchmerge, bool(partial))) |
|
357 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % | |
|
358 | (short(p1), short(p2), short(pa))) | |
|
357 | repo.ui.debug(_(" ancestor %s local %s remote %s\n") % (p1, p2, pa)) | |
|
359 | 358 | |
|
360 | 359 | action = [] |
|
361 | 360 | copy = {} |
@@ -369,7 +368,7 b' def update(repo, node, branchmerge=False' | |||
|
369 | 368 | if not branchmerge: |
|
370 | 369 | action += forgetremoved(m2, status) |
|
371 | 370 | if not (backwards or overwrite): |
|
372 |
copy = findcopies(repo, m1, m2, |
|
|
371 | copy = findcopies(repo, m1, m2, pa.rev()) | |
|
373 | 372 | |
|
374 | 373 | action += manifestmerge(repo.ui, m1, m2, ma, overwrite, backwards) |
|
375 | 374 | del m1, m2, ma |
@@ -378,10 +377,10 b' def update(repo, node, branchmerge=False' | |||
|
378 | 377 | |
|
379 | 378 | if not branchmerge: |
|
380 | 379 | # we don't need to do any magic, just jump to the new rev |
|
381 | p1, p2 = p2, nullid | |
|
380 | p1, p2 = p2, repo.changectx(nullid) | |
|
382 | 381 | |
|
383 |
xp1, xp2 = |
|
|
384 |
if p2 |
|
|
382 | xp1, xp2 = str(p1), str(p2) | |
|
383 | if not p2: xp2 = '' | |
|
385 | 384 | |
|
386 | 385 | repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) |
|
387 | 386 | |
@@ -389,7 +388,7 b' def update(repo, node, branchmerge=False' | |||
|
389 | 388 | |
|
390 | 389 | # update dirstate |
|
391 | 390 | if not partial: |
|
392 | repo.dirstate.setparents(p1, p2) | |
|
391 | repo.dirstate.setparents(p1.node(), p2.node()) | |
|
393 | 392 | recordupdates(repo, action, branchmerge) |
|
394 | 393 | |
|
395 | 394 | if show_stats: |
@@ -406,8 +405,7 b' def update(repo, node, branchmerge=False' | |||
|
406 | 405 | " you can redo the full merge using:\n" |
|
407 | 406 | " hg update -C %s\n" |
|
408 | 407 | " hg merge %s\n" |
|
409 |
% ( |
|
|
410 | repo.changelog.rev(p2)))) | |
|
408 | % (p1.rev(), p2.rev()))) | |
|
411 | 409 | elif remind: |
|
412 | 410 | repo.ui.status(_("(branch merge, don't forget to commit)\n")) |
|
413 | 411 | elif unresolved: |
@@ -62,10 +62,10 b' precommit hook: p1=8ea2ef7ad3e8cac946c72' | |||
|
62 | 62 | precommit.forbid hook |
|
63 | 63 | abort: precommit.forbid hook exited with status 1 |
|
64 | 64 | 4:8ea2ef7ad3e8 |
|
65 |
preupdate hook: p1=b702efe96888 |
|
|
65 | preupdate hook: p1=b702efe96888 p2= | |
|
66 | 66 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
67 |
preupdate hook: p1=8ea2ef7ad3e8 |
|
|
68 |
update hook: p1=8ea2ef7ad3e8 |
|
|
67 | preupdate hook: p1=8ea2ef7ad3e8 p2= | |
|
68 | update hook: p1=8ea2ef7ad3e8 p2= err=0 | |
|
69 | 69 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
70 | 70 | 3:4c52fb2e4022 |
|
71 | 71 | prechangegroup.forbid hook |
General Comments 0
You need to be logged in to leave comments.
Login now