Show More
@@ -2896,6 +2896,14 b' def debugmergestate(ui, repo, *args):' | |||||
2896 |
|
2896 | |||
2897 | ui.write(('file extras: %s (%s)\n') |
|
2897 | ui.write(('file extras: %s (%s)\n') | |
2898 | % (filename, ', '.join(extrastrings))) |
|
2898 | % (filename, ', '.join(extrastrings))) | |
|
2899 | elif rtype == 'l': | |||
|
2900 | labels = record.split('\0', 2) | |||
|
2901 | labels = [l for l in labels if len(l) > 0] | |||
|
2902 | ui.write(('labels:\n')) | |||
|
2903 | ui.write((' local: %s\n' % labels[0])) | |||
|
2904 | ui.write((' other: %s\n' % labels[1])) | |||
|
2905 | if len(labels) > 2: | |||
|
2906 | ui.write((' base: %s\n' % labels[2])) | |||
2899 | else: |
|
2907 | else: | |
2900 | ui.write(('unrecognized entry: %s\t%s\n') |
|
2908 | ui.write(('unrecognized entry: %s\t%s\n') | |
2901 | % (rtype, record.replace('\0', '\t'))) |
|
2909 | % (rtype, record.replace('\0', '\t'))) | |
@@ -2908,7 +2916,7 b' def debugmergestate(ui, repo, *args):' | |||||
2908 | # sort so that reasonable information is on top |
|
2916 | # sort so that reasonable information is on top | |
2909 | v1records = ms._readrecordsv1() |
|
2917 | v1records = ms._readrecordsv1() | |
2910 | v2records = ms._readrecordsv2() |
|
2918 | v2records = ms._readrecordsv2() | |
2911 | order = 'LOm' |
|
2919 | order = 'LOml' | |
2912 | def key(r): |
|
2920 | def key(r): | |
2913 | idx = order.find(r[0]) |
|
2921 | idx = order.find(r[0]) | |
2914 | if idx == -1: |
|
2922 | if idx == -1: |
@@ -68,6 +68,7 b' class mergestate(object):' | |||||
68 | f: a (filename, dictonary) tuple of optional values for a given file |
|
68 | f: a (filename, dictonary) tuple of optional values for a given file | |
69 | X: unsupported mandatory record type (used in tests) |
|
69 | X: unsupported mandatory record type (used in tests) | |
70 | x: unsupported advisory record type (used in tests) |
|
70 | x: unsupported advisory record type (used in tests) | |
|
71 | l: the labels for the parts of the merge. | |||
71 |
|
72 | |||
72 | Merge driver run states (experimental): |
|
73 | Merge driver run states (experimental): | |
73 | u: driver-resolved files unmarked -- needs to be run next time we're about |
|
74 | u: driver-resolved files unmarked -- needs to be run next time we're about | |
@@ -80,11 +81,11 b' class mergestate(object):' | |||||
80 | statepathv2 = 'merge/state2' |
|
81 | statepathv2 = 'merge/state2' | |
81 |
|
82 | |||
82 | @staticmethod |
|
83 | @staticmethod | |
83 | def clean(repo, node=None, other=None): |
|
84 | def clean(repo, node=None, other=None, labels=None): | |
84 | """Initialize a brand new merge state, removing any existing state on |
|
85 | """Initialize a brand new merge state, removing any existing state on | |
85 | disk.""" |
|
86 | disk.""" | |
86 | ms = mergestate(repo) |
|
87 | ms = mergestate(repo) | |
87 | ms.reset(node, other) |
|
88 | ms.reset(node, other, labels) | |
88 | return ms |
|
89 | return ms | |
89 |
|
90 | |||
90 | @staticmethod |
|
91 | @staticmethod | |
@@ -100,12 +101,14 b' class mergestate(object):' | |||||
100 | Do not use this directly! Instead call read() or clean().""" |
|
101 | Do not use this directly! Instead call read() or clean().""" | |
101 | self._repo = repo |
|
102 | self._repo = repo | |
102 | self._dirty = False |
|
103 | self._dirty = False | |
|
104 | self._labels = None | |||
103 |
|
105 | |||
104 | def reset(self, node=None, other=None): |
|
106 | def reset(self, node=None, other=None, labels=None): | |
105 | self._state = {} |
|
107 | self._state = {} | |
106 | self._stateextras = {} |
|
108 | self._stateextras = {} | |
107 | self._local = None |
|
109 | self._local = None | |
108 | self._other = None |
|
110 | self._other = None | |
|
111 | self._labels = labels | |||
109 | for var in ('localctx', 'otherctx'): |
|
112 | for var in ('localctx', 'otherctx'): | |
110 | if var in vars(self): |
|
113 | if var in vars(self): | |
111 | delattr(self, var) |
|
114 | delattr(self, var) | |
@@ -165,6 +168,9 b' class mergestate(object):' | |||||
165 | i += 2 |
|
168 | i += 2 | |
166 |
|
169 | |||
167 | self._stateextras[filename] = extras |
|
170 | self._stateextras[filename] = extras | |
|
171 | elif rtype == 'l': | |||
|
172 | labels = record.split('\0', 2) | |||
|
173 | self._labels = [l for l in labels if len(l) > 0] | |||
168 | elif not rtype.islower(): |
|
174 | elif not rtype.islower(): | |
169 | unsupported.add(rtype) |
|
175 | unsupported.add(rtype) | |
170 | self._results = {} |
|
176 | self._results = {} | |
@@ -353,6 +359,9 b' class mergestate(object):' | |||||
353 | rawextras = '\0'.join('%s\0%s' % (k, v) for k, v in |
|
359 | rawextras = '\0'.join('%s\0%s' % (k, v) for k, v in | |
354 | extras.iteritems()) |
|
360 | extras.iteritems()) | |
355 | records.append(('f', '%s\0%s' % (filename, rawextras))) |
|
361 | records.append(('f', '%s\0%s' % (filename, rawextras))) | |
|
362 | if self._labels is not None: | |||
|
363 | labels = '\0'.join(self._labels) | |||
|
364 | records.append(('l', labels)) | |||
356 | return records |
|
365 | return records | |
357 |
|
366 | |||
358 | def _writerecords(self, records): |
|
367 | def _writerecords(self, records): | |
@@ -444,7 +453,7 b' class mergestate(object):' | |||||
444 | def extras(self, filename): |
|
453 | def extras(self, filename): | |
445 | return self._stateextras.setdefault(filename, {}) |
|
454 | return self._stateextras.setdefault(filename, {}) | |
446 |
|
455 | |||
447 |
def _resolve(self, preresolve, dfile, wctx |
|
456 | def _resolve(self, preresolve, dfile, wctx): | |
448 | """rerun merge process for file path `dfile`""" |
|
457 | """rerun merge process for file path `dfile`""" | |
449 | if self[dfile] in 'rd': |
|
458 | if self[dfile] in 'rd': | |
450 | return True, 0 |
|
459 | return True, 0 | |
@@ -481,11 +490,11 b' class mergestate(object):' | |||||
481 | self._repo.wvfs.unlinkpath(dfile, ignoremissing=True) |
|
490 | self._repo.wvfs.unlinkpath(dfile, ignoremissing=True) | |
482 | complete, r, deleted = filemerge.premerge(self._repo, self._local, |
|
491 | complete, r, deleted = filemerge.premerge(self._repo, self._local, | |
483 | lfile, fcd, fco, fca, |
|
492 | lfile, fcd, fco, fca, | |
484 | labels=labels) |
|
493 | labels=self._labels) | |
485 | else: |
|
494 | else: | |
486 | complete, r, deleted = filemerge.filemerge(self._repo, self._local, |
|
495 | complete, r, deleted = filemerge.filemerge(self._repo, self._local, | |
487 | lfile, fcd, fco, fca, |
|
496 | lfile, fcd, fco, fca, | |
488 | labels=labels) |
|
497 | labels=self._labels) | |
489 | if r is None: |
|
498 | if r is None: | |
490 | # no real conflict |
|
499 | # no real conflict | |
491 | del self._state[dfile] |
|
500 | del self._state[dfile] | |
@@ -523,17 +532,17 b' class mergestate(object):' | |||||
523 | else: |
|
532 | else: | |
524 | return ctx[f] |
|
533 | return ctx[f] | |
525 |
|
534 | |||
526 |
def preresolve(self, dfile, wctx |
|
535 | def preresolve(self, dfile, wctx): | |
527 | """run premerge process for dfile |
|
536 | """run premerge process for dfile | |
528 |
|
537 | |||
529 | Returns whether the merge is complete, and the exit code.""" |
|
538 | Returns whether the merge is complete, and the exit code.""" | |
530 |
return self._resolve(True, dfile, wctx |
|
539 | return self._resolve(True, dfile, wctx) | |
531 |
|
540 | |||
532 |
def resolve(self, dfile, wctx |
|
541 | def resolve(self, dfile, wctx): | |
533 | """run merge process (assuming premerge was run) for dfile |
|
542 | """run merge process (assuming premerge was run) for dfile | |
534 |
|
543 | |||
535 | Returns the exit code of the merge.""" |
|
544 | Returns the exit code of the merge.""" | |
536 |
return self._resolve(False, dfile, wctx |
|
545 | return self._resolve(False, dfile, wctx)[1] | |
537 |
|
546 | |||
538 | def counts(self): |
|
547 | def counts(self): | |
539 | """return counts for updated, merged and removed files in this |
|
548 | """return counts for updated, merged and removed files in this | |
@@ -1094,7 +1103,7 b' def applyupdates(repo, actions, wctx, mc' | |||||
1094 | """ |
|
1103 | """ | |
1095 |
|
1104 | |||
1096 | updated, merged, removed = 0, 0, 0 |
|
1105 | updated, merged, removed = 0, 0, 0 | |
1097 | ms = mergestate.clean(repo, wctx.p1().node(), mctx.node()) |
|
1106 | ms = mergestate.clean(repo, wctx.p1().node(), mctx.node(), labels) | |
1098 | moves = [] |
|
1107 | moves = [] | |
1099 | for m, l in actions.items(): |
|
1108 | for m, l in actions.items(): | |
1100 | l.sort() |
|
1109 | l.sort() | |
@@ -1247,7 +1256,7 b' def applyupdates(repo, actions, wctx, mc' | |||||
1247 | overwrite) |
|
1256 | overwrite) | |
1248 | continue |
|
1257 | continue | |
1249 | audit(f) |
|
1258 | audit(f) | |
1250 |
complete, r = ms.preresolve(f, wctx |
|
1259 | complete, r = ms.preresolve(f, wctx) | |
1251 | if not complete: |
|
1260 | if not complete: | |
1252 | numupdates += 1 |
|
1261 | numupdates += 1 | |
1253 | tocomplete.append((f, args, msg)) |
|
1262 | tocomplete.append((f, args, msg)) | |
@@ -1257,7 +1266,7 b' def applyupdates(repo, actions, wctx, mc' | |||||
1257 | repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) |
|
1266 | repo.ui.debug(" %s: %s -> m (merge)\n" % (f, msg)) | |
1258 | z += 1 |
|
1267 | z += 1 | |
1259 | progress(_updating, z, item=f, total=numupdates, unit=_files) |
|
1268 | progress(_updating, z, item=f, total=numupdates, unit=_files) | |
1260 |
ms.resolve(f, wctx |
|
1269 | ms.resolve(f, wctx) | |
1261 |
|
1270 | |||
1262 | ms.commit() |
|
1271 | ms.commit() | |
1263 |
|
1272 |
@@ -452,7 +452,7 b' Resolve conflicted graft' | |||||
452 | c |
|
452 | c | |
453 | ======= |
|
453 | ======= | |
454 | b |
|
454 | b | |
455 |
>>>>>>> |
|
455 | >>>>>>> graft: 5d205f8b35b6 - bar: 1 | |
456 | $ echo b > a |
|
456 | $ echo b > a | |
457 | $ hg resolve -m a |
|
457 | $ hg resolve -m a | |
458 | (no more unresolved files) |
|
458 | (no more unresolved files) |
@@ -80,6 +80,9 b' insert unsupported advisory merge record' | |||||
80 | * version 2 records |
|
80 | * version 2 records | |
81 | local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758 |
|
81 | local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758 | |
82 | other: e860deea161a2f77de56603b340ebbb4536308ae |
|
82 | other: e860deea161a2f77de56603b340ebbb4536308ae | |
|
83 | labels: | |||
|
84 | local: local | |||
|
85 | other: histedit | |||
83 | unrecognized entry: x advisory record |
|
86 | unrecognized entry: x advisory record | |
84 | file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000) |
|
87 | file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000) | |
85 | file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f) |
|
88 | file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f) | |
@@ -95,6 +98,9 b' insert unsupported mandatory merge recor' | |||||
95 | * version 2 records |
|
98 | * version 2 records | |
96 | local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758 |
|
99 | local: 8f7551c7e4a2f2efe0bc8c741baf7f227d65d758 | |
97 | other: e860deea161a2f77de56603b340ebbb4536308ae |
|
100 | other: e860deea161a2f77de56603b340ebbb4536308ae | |
|
101 | labels: | |||
|
102 | local: local | |||
|
103 | other: histedit | |||
98 | file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000) |
|
104 | file extras: e (ancestorlinknode = 0000000000000000000000000000000000000000) | |
99 | file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f) |
|
105 | file: e (record type "F", state "u", hash 58e6b3a414a1e090dfc6029add0f3555ccba127f) | |
100 | local path: e (flags "") |
|
106 | local path: e (flags "") |
@@ -736,6 +736,9 b' Non-interactive linear update' | |||||
736 | * version 2 records |
|
736 | * version 2 records | |
737 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
737 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
738 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
738 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
739 | labels: | |||
|
740 | local: working copy | |||
|
741 | other: destination | |||
739 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
742 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
740 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
743 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
741 | local path: file1 (flags "") |
|
744 | local path: file1 (flags "") | |
@@ -776,6 +779,9 b' Choose local versions of files' | |||||
776 | * version 2 records |
|
779 | * version 2 records | |
777 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
780 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
778 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
781 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
782 | labels: | |||
|
783 | local: working copy | |||
|
784 | other: destination | |||
779 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
785 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
780 | file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
786 | file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
781 | local path: file1 (flags "") |
|
787 | local path: file1 (flags "") | |
@@ -814,6 +820,9 b' Choose other versions of files' | |||||
814 | * version 2 records |
|
820 | * version 2 records | |
815 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
821 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
816 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
822 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
823 | labels: | |||
|
824 | local: working copy | |||
|
825 | other: destination | |||
817 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
826 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
818 | file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
827 | file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
819 | local path: file1 (flags "") |
|
828 | local path: file1 (flags "") | |
@@ -854,6 +863,9 b' Fail' | |||||
854 | * version 2 records |
|
863 | * version 2 records | |
855 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
864 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
856 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
865 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
866 | labels: | |||
|
867 | local: working copy | |||
|
868 | other: destination | |||
857 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
869 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
858 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
870 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
859 | local path: file1 (flags "") |
|
871 | local path: file1 (flags "") | |
@@ -900,6 +912,9 b' Force prompts with no input' | |||||
900 | * version 2 records |
|
912 | * version 2 records | |
901 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
913 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
902 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
914 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
915 | labels: | |||
|
916 | local: working copy | |||
|
917 | other: destination | |||
903 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
918 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
904 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
919 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
905 | local path: file1 (flags "") |
|
920 | local path: file1 (flags "") | |
@@ -947,6 +962,9 b' Choose to merge all files' | |||||
947 | * version 2 records |
|
962 | * version 2 records | |
948 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff |
|
963 | local: ab57bf49aa276a22d35a473592d4c34b5abc3eff | |
949 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 |
|
964 | other: 10f9a0a634e82080907e62f075ab119cbc565ea6 | |
|
965 | labels: | |||
|
966 | local: working copy | |||
|
967 | other: destination | |||
950 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) |
|
968 | file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff) | |
951 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) |
|
969 | file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390) | |
952 | local path: file1 (flags "") |
|
970 | local path: file1 (flags "") |
@@ -75,6 +75,9 b' Insert unsupported advisory merge record' | |||||
75 | * version 2 records |
|
75 | * version 2 records | |
76 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc |
|
76 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc | |
77 | other: 46f0b057b5c061d276b91491c22151f78698abd2 |
|
77 | other: 46f0b057b5c061d276b91491c22151f78698abd2 | |
|
78 | labels: | |||
|
79 | local: dest | |||
|
80 | other: source | |||
78 | unrecognized entry: x advisory record |
|
81 | unrecognized entry: x advisory record | |
79 | file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c) |
|
82 | file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c) | |
80 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) |
|
83 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) | |
@@ -91,6 +94,9 b' Insert unsupported mandatory merge recor' | |||||
91 | * version 2 records |
|
94 | * version 2 records | |
92 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc |
|
95 | local: 3e046f2ecedb793b97ed32108086edd1a162f8bc | |
93 | other: 46f0b057b5c061d276b91491c22151f78698abd2 |
|
96 | other: 46f0b057b5c061d276b91491c22151f78698abd2 | |
|
97 | labels: | |||
|
98 | local: dest | |||
|
99 | other: source | |||
94 | file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c) |
|
100 | file extras: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c) | |
95 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) |
|
101 | file: common (record type "F", state "u", hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1) | |
96 | local path: common (flags "") |
|
102 | local path: common (flags "") |
General Comments 0
You need to be logged in to leave comments.
Login now