Show More
@@ -1583,8 +1583,7 b' class memctx(committablectx):' | |||
|
1583 | 1583 | p1, p2 = parents |
|
1584 | 1584 | self._parents = [changectx(self._repo, p) for p in (p1, p2)] |
|
1585 | 1585 | files = sorted(set(files)) |
|
1586 | self._status = scmutil.status(files, [], [], [], [], [], []) | |
|
1587 | self._filectxfn = filectxfn | |
|
1586 | self._files = files | |
|
1588 | 1587 | self.substate = {} |
|
1589 | 1588 | |
|
1590 | 1589 | # if store is not callable, wrap it in a function |
@@ -1600,6 +1599,10 b' class memctx(committablectx):' | |||
|
1600 | 1599 | islink=fctx.islink(), isexec=fctx.isexec(), |
|
1601 | 1600 | copied=copied, memctx=memctx) |
|
1602 | 1601 | self._filectxfn = getfilectx |
|
1602 | else: | |
|
1603 | # "util.cachefunc" reduces invocation of possibly expensive | |
|
1604 | # "filectxfn" for performance (e.g. converting from another VCS) | |
|
1605 | self._filectxfn = util.cachefunc(filectxfn) | |
|
1603 | 1606 | |
|
1604 | 1607 | self._extra = extra and extra.copy() or {} |
|
1605 | 1608 | if self._extra.get('branch', '') == '': |
@@ -1645,6 +1648,31 b' class memctx(committablectx):' | |||
|
1645 | 1648 | |
|
1646 | 1649 | return man |
|
1647 | 1650 | |
|
1651 | @propertycache | |
|
1652 | def _status(self): | |
|
1653 | """Calculate exact status from ``files`` specified at construction | |
|
1654 | """ | |
|
1655 | man1 = self.p1().manifest() | |
|
1656 | p2 = self._parents[1] | |
|
1657 | # "1 < len(self._parents)" can't be used for checking | |
|
1658 | # existence of the 2nd parent, because "memctx._parents" is | |
|
1659 | # explicitly initialized by the list, of which length is 2. | |
|
1660 | if p2.node() != nullid: | |
|
1661 | man2 = p2.manifest() | |
|
1662 | managing = lambda f: f in man1 or f in man2 | |
|
1663 | else: | |
|
1664 | managing = lambda f: f in man1 | |
|
1665 | ||
|
1666 | modified, added, removed = [], [], [] | |
|
1667 | for f in self._files: | |
|
1668 | if not managing(f): | |
|
1669 | added.append(f) | |
|
1670 | elif self[f]: | |
|
1671 | modified.append(f) | |
|
1672 | else: | |
|
1673 | removed.append(f) | |
|
1674 | ||
|
1675 | return scmutil.status(modified, added, removed, [], [], [], []) | |
|
1648 | 1676 | |
|
1649 | 1677 | class memfilectx(committablefilectx): |
|
1650 | 1678 | """memfilectx represents an in-memory file to commit. |
@@ -842,6 +842,8 b' Test that amend with --edit invokes edit' | |||
|
842 | 842 | $ hg parents --template "{desc}\n" |
|
843 | 843 | editor should be suppressed |
|
844 | 844 | |
|
845 | $ hg status --rev '.^1::.' | |
|
846 | A foo | |
|
845 | 847 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
846 | 848 | editor should be invoked |
|
847 | 849 | |
@@ -851,7 +853,7 b' Test that amend with --edit invokes edit' | |||
|
851 | 853 | HG: -- |
|
852 | 854 | HG: user: test |
|
853 | 855 | HG: branch 'silliness' |
|
854 |
HG: |
|
|
856 | HG: added foo | |
|
855 | 857 | $ hg parents --template "{desc}\n" |
|
856 | 858 | editor should be invoked |
|
857 | 859 |
@@ -78,13 +78,11 b' Convert while testing all possible outpu' | |||
|
78 | 78 | reparent to file://*/svn-repo/trunk (glob) |
|
79 | 79 | scanning paths: /trunk/\xc3\xb9 3/4 (75.00%) (esc) |
|
80 | 80 | mark /trunk/\xc3\xb9 came from \xc3\xa0:2 (esc) |
|
81 | \xc3\xa0/e\xcc\x81 (esc) | |
|
82 | 81 | getting files: \xc3\xa0/e\xcc\x81 1/4 (25.00%) (esc) |
|
82 | getting files: \xc3\xa9 2/4 (50.00%) (esc) | |
|
83 | 83 | \xc3\xa8 (esc) |
|
84 |
getting files: \xc3\xa8 |
|
|
84 | getting files: \xc3\xa8 3/4 (75.00%) (esc) | |
|
85 | 85 | \xc3\xa8: copy \xc3\xa9:6b67ccefd5ce6de77e7ead4f5292843a0255329f (esc) |
|
86 | \xc3\xa9 (esc) | |
|
87 | getting files: \xc3\xa9 3/4 (75.00%) (esc) | |
|
88 | 86 | \xc3\xb9/e\xcc\x81 (esc) |
|
89 | 87 | getting files: \xc3\xb9/e\xcc\x81 4/4 (100.00%) (esc) |
|
90 | 88 | \xc3\xb9/e\xcc\x81: copy \xc3\xa0/e\xcc\x81:a9092a3d84a37b9993b5c73576f6de29b7ea50f6 (esc) |
@@ -99,9 +97,7 b' Convert while testing all possible outpu' | |||
|
99 | 97 | gone from -1 |
|
100 | 98 | reparent to file://*/svn-repo (glob) |
|
101 | 99 | reparent to file://*/svn-repo/trunk (glob) |
|
102 | \xc3\xa8 (esc) | |
|
103 | 100 | getting files: \xc3\xa8 1/2 (50.00%) (esc) |
|
104 | \xc3\xb9/e\xcc\x81 (esc) | |
|
105 | 101 | getting files: \xc3\xb9/e\xcc\x81 2/2 (100.00%) (esc) |
|
106 | 102 | 1 branch to branch? |
|
107 | 103 | source: svn:afeb9c47-92ff-4c0c-9f72-e1f6eb8ac9af/branches/branch?@5 |
@@ -172,11 +172,16 b' check saving last-message.txt' | |||
|
172 | 172 | > EOF |
|
173 | 173 | |
|
174 | 174 | $ rm -f .hg/last-message.txt |
|
175 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF | fixbundle | |
|
175 | $ hg status --rev '8e03a72b6f83^1::c4a9eb7989fc' | |
|
176 | A c | |
|
177 | A d | |
|
178 | A f | |
|
179 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 8e03a72b6f83 --commands - 2>&1 <<EOF | |
|
176 | 180 | > pick 8e03a72b6f83 f |
|
177 | 181 | > fold c4a9eb7989fc d |
|
178 | 182 | > EOF |
|
179 | 183 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
184 | adding d | |
|
180 | 185 | allow non-folding commit |
|
181 | 186 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
182 | 187 | ==== before editing |
@@ -193,13 +198,14 b' check saving last-message.txt' | |||
|
193 | 198 | HG: -- |
|
194 | 199 | HG: user: test |
|
195 | 200 | HG: branch 'default' |
|
196 |
HG: |
|
|
197 |
HG: |
|
|
198 |
HG: |
|
|
201 | HG: added c | |
|
202 | HG: added d | |
|
203 | HG: added f | |
|
199 | 204 | ==== |
|
200 | 205 | transaction abort! |
|
201 | 206 | rollback completed |
|
202 | 207 | abort: pretxncommit.abortfolding hook failed |
|
208 | [255] | |
|
203 | 209 | |
|
204 | 210 | $ cat .hg/last-message.txt |
|
205 | 211 | f |
General Comments 0
You need to be logged in to leave comments.
Login now