Show More
@@ -136,6 +136,9 b' def bookmark(ui, repo, mark=None, rev=No' | |||||
136 | if "\n" in mark: |
|
136 | if "\n" in mark: | |
137 | raise util.Abort(_("bookmark name cannot contain newlines")) |
|
137 | raise util.Abort(_("bookmark name cannot contain newlines")) | |
138 | mark = mark.strip() |
|
138 | mark = mark.strip() | |
|
139 | if not mark: | |||
|
140 | raise util.Abort(_("bookmark names cannot consist entirely of " | |||
|
141 | "whitespace")) | |||
139 | if mark in marks and not force: |
|
142 | if mark in marks and not force: | |
140 | raise util.Abort(_("a bookmark of the same name already exists")) |
|
143 | raise util.Abort(_("a bookmark of the same name already exists")) | |
141 | if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) |
|
144 | if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) |
@@ -1687,11 +1687,22 b' class queue(object):' | |||||
1687 | if existing: |
|
1687 | if existing: | |
1688 | if filename == '-': |
|
1688 | if filename == '-': | |
1689 | raise util.Abort(_('-e is incompatible with import from -')) |
|
1689 | raise util.Abort(_('-e is incompatible with import from -')) | |
1690 | if not patchname: |
|
1690 | filename = normname(filename) | |
1691 |
|
|
1691 | self.check_reserved_name(filename) | |
1692 | self.check_reserved_name(patchname) |
|
1692 | originpath = self.join(filename) | |
1693 |
if not os.path.isfile( |
|
1693 | if not os.path.isfile(originpath): | |
1694 |
raise util.Abort(_("patch %s does not exist") % |
|
1694 | raise util.Abort(_("patch %s does not exist") % filename) | |
|
1695 | ||||
|
1696 | if patchname: | |||
|
1697 | self.check_reserved_name(patchname) | |||
|
1698 | checkfile(patchname) | |||
|
1699 | ||||
|
1700 | self.ui.write(_('renaming %s to %s\n') | |||
|
1701 | % (filename, patchname)) | |||
|
1702 | util.rename(originpath, self.join(patchname)) | |||
|
1703 | else: | |||
|
1704 | patchname = filename | |||
|
1705 | ||||
1695 | else: |
|
1706 | else: | |
1696 | try: |
|
1707 | try: | |
1697 | if filename == '-': |
|
1708 | if filename == '-': | |
@@ -1806,6 +1817,10 b' def qimport(ui, repo, *filename, **opts)' | |||||
1806 | To import a patch from standard input, pass - as the patch file. |
|
1817 | To import a patch from standard input, pass - as the patch file. | |
1807 | When importing from standard input, a patch name must be specified |
|
1818 | When importing from standard input, a patch name must be specified | |
1808 | using the --name flag. |
|
1819 | using the --name flag. | |
|
1820 | ||||
|
1821 | To import an existing patch while renaming it:: | |||
|
1822 | ||||
|
1823 | hg qimport -e existing-patch -n new-name | |||
1809 | """ |
|
1824 | """ | |
1810 | q = repo.mq |
|
1825 | q = repo.mq | |
1811 | try: |
|
1826 | try: |
@@ -352,12 +352,12 b' class filectx(object):' | |||||
352 | def size(self): |
|
352 | def size(self): | |
353 | return self._filelog.size(self._filerev) |
|
353 | return self._filelog.size(self._filerev) | |
354 |
|
354 | |||
355 |
def cmp(self, t |
|
355 | def cmp(self, fctx): | |
356 |
"""compare |
|
356 | """compare with other file context | |
357 |
|
357 | |||
358 |
returns True if |
|
358 | returns True if different than fctx. | |
359 | """ |
|
359 | """ | |
360 |
return self._filelog.cmp(self._filenode, t |
|
360 | return self._filelog.cmp(self._filenode, fctx.data()) | |
361 |
|
361 | |||
362 | def renamed(self): |
|
362 | def renamed(self): | |
363 | """check if file was actually renamed in this changeset revision |
|
363 | """check if file was actually renamed in this changeset revision | |
@@ -935,12 +935,14 b' class workingfilectx(filectx):' | |||||
935 | raise |
|
935 | raise | |
936 | return (t, tz) |
|
936 | return (t, tz) | |
937 |
|
937 | |||
938 |
def cmp(self, t |
|
938 | def cmp(self, fctx): | |
939 |
"""compare |
|
939 | """compare with other file context | |
940 |
|
940 | |||
941 |
returns True if |
|
941 | returns True if different than fctx. | |
942 | """ |
|
942 | """ | |
943 | return self._repo.wread(self._path) != text |
|
943 | # fctx should be a filectx (not a wfctx) | |
|
944 | # invert comparison to reuse the same code path | |||
|
945 | return fctx.cmp(self) | |||
944 |
|
946 | |||
945 | class memctx(object): |
|
947 | class memctx(object): | |
946 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
948 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
@@ -135,7 +135,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||||
135 | except IOError: |
|
135 | except IOError: | |
136 | return False |
|
136 | return False | |
137 |
|
137 | |||
138 |
if not fco.cmp(fcd |
|
138 | if not fco.cmp(fcd): # files identical? | |
139 | return None |
|
139 | return None | |
140 |
|
140 | |||
141 | if fca == fco: # backwards, use working dir parent as ancestor |
|
141 | if fca == fco: # backwards, use working dir parent as ancestor |
@@ -100,6 +100,9 b' The following predicates are supported:' | |||||
100 | ``max(set)`` |
|
100 | ``max(set)`` | |
101 | Changeset with highest revision number in set. |
|
101 | Changeset with highest revision number in set. | |
102 |
|
102 | |||
|
103 | ``min(set)`` | |||
|
104 | Changeset with lowest revision number in set. | |||
|
105 | ||||
103 | ``merge()`` |
|
106 | ``merge()`` | |
104 | Changeset is a merge changeset. |
|
107 | Changeset is a merge changeset. | |
105 |
|
108 |
@@ -510,7 +510,7 b' class localrepository(repo.repository):' | |||||
510 | def _link(self, f): |
|
510 | def _link(self, f): | |
511 | return os.path.islink(self.wjoin(f)) |
|
511 | return os.path.islink(self.wjoin(f)) | |
512 |
|
512 | |||
513 |
def _filter(self, filter |
|
513 | def _loadfilter(self, filter): | |
514 | if filter not in self.filterpats: |
|
514 | if filter not in self.filterpats: | |
515 | l = [] |
|
515 | l = [] | |
516 | for pat, cmd in self.ui.configitems(filter): |
|
516 | for pat, cmd in self.ui.configitems(filter): | |
@@ -533,6 +533,9 b' class localrepository(repo.repository):' | |||||
533 | l.append((mf, fn, params)) |
|
533 | l.append((mf, fn, params)) | |
534 | self.filterpats[filter] = l |
|
534 | self.filterpats[filter] = l | |
535 |
|
535 | |||
|
536 | def _filter(self, filter, filename, data): | |||
|
537 | self._loadfilter(filter) | |||
|
538 | ||||
536 | for mf, fn, cmd in self.filterpats[filter]: |
|
539 | for mf, fn, cmd in self.filterpats[filter]: | |
537 | if mf(filename): |
|
540 | if mf(filename): | |
538 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) |
|
541 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) | |
@@ -1059,7 +1062,7 b' class localrepository(repo.repository):' | |||||
1059 | # do a full compare of any files that might have changed |
|
1062 | # do a full compare of any files that might have changed | |
1060 | for f in sorted(cmp): |
|
1063 | for f in sorted(cmp): | |
1061 | if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) |
|
1064 | if (f not in ctx1 or ctx2.flags(f) != ctx1.flags(f) | |
1062 |
or ctx1[f].cmp(ctx2[f] |
|
1065 | or ctx1[f].cmp(ctx2[f])): | |
1063 | modified.append(f) |
|
1066 | modified.append(f) | |
1064 | else: |
|
1067 | else: | |
1065 | fixup.append(f) |
|
1068 | fixup.append(f) | |
@@ -1103,7 +1106,7 b' class localrepository(repo.repository):' | |||||
1103 | if fn in mf1: |
|
1106 | if fn in mf1: | |
1104 | if (mf1.flags(fn) != mf2.flags(fn) or |
|
1107 | if (mf1.flags(fn) != mf2.flags(fn) or | |
1105 | (mf1[fn] != mf2[fn] and |
|
1108 | (mf1[fn] != mf2[fn] and | |
1106 |
(mf2[fn] or ctx1[fn].cmp(ctx2[fn] |
|
1109 | (mf2[fn] or ctx1[fn].cmp(ctx2[fn])))): | |
1107 | modified.append(fn) |
|
1110 | modified.append(fn) | |
1108 | elif listclean: |
|
1111 | elif listclean: | |
1109 | clean.append(fn) |
|
1112 | clean.append(fn) |
@@ -73,7 +73,7 b' class mergestate(object):' | |||||
73 | def _checkunknown(wctx, mctx): |
|
73 | def _checkunknown(wctx, mctx): | |
74 | "check for collisions between unknown files and files in mctx" |
|
74 | "check for collisions between unknown files and files in mctx" | |
75 | for f in wctx.unknown(): |
|
75 | for f in wctx.unknown(): | |
76 |
if f in mctx and mctx[f].cmp(wctx[f] |
|
76 | if f in mctx and mctx[f].cmp(wctx[f]): | |
77 | raise util.Abort(_("untracked file in working directory differs" |
|
77 | raise util.Abort(_("untracked file in working directory differs" | |
78 | " from file in requested revision: '%s'") % f) |
|
78 | " from file in requested revision: '%s'") % f) | |
79 |
|
79 |
@@ -195,6 +195,14 b' def maxrev(repo, subset, x):' | |||||
195 | return [m] |
|
195 | return [m] | |
196 | return [] |
|
196 | return [] | |
197 |
|
197 | |||
|
198 | def minrev(repo, subset, x): | |||
|
199 | s = getset(repo, subset, x) | |||
|
200 | if s: | |||
|
201 | m = min(s) | |||
|
202 | if m in subset: | |||
|
203 | return [m] | |||
|
204 | return [] | |||
|
205 | ||||
198 | def limit(repo, subset, x): |
|
206 | def limit(repo, subset, x): | |
199 | l = getargs(x, 2, 2, _("limit wants two arguments")) |
|
207 | l = getargs(x, 2, 2, _("limit wants two arguments")) | |
200 | try: |
|
208 | try: | |
@@ -466,6 +474,7 b' symbols = {' | |||||
466 | "keyword": keyword, |
|
474 | "keyword": keyword, | |
467 | "limit": limit, |
|
475 | "limit": limit, | |
468 | "max": maxrev, |
|
476 | "max": maxrev, | |
|
477 | "min": minrev, | |||
469 | "merge": merge, |
|
478 | "merge": merge, | |
470 | "modifies": modifies, |
|
479 | "modifies": modifies, | |
471 | "outgoing": outgoing, |
|
480 | "outgoing": outgoing, |
@@ -100,4 +100,7 b' hg bookmark' | |||||
100 | echo % revision but no bookmark name |
|
100 | echo % revision but no bookmark name | |
101 | hg bookmark -r . |
|
101 | hg bookmark -r . | |
102 |
|
102 | |||
|
103 | echo % bookmark name with whitespace only | |||
|
104 | hg bookmark ' ' | |||
|
105 | ||||
103 | true |
|
106 | true |
@@ -74,3 +74,5 b' abort: a bookmark of the same name alrea' | |||||
74 | * x y 2:0316ce92851d |
|
74 | * x y 2:0316ce92851d | |
75 | % revision but no bookmark name |
|
75 | % revision but no bookmark name | |
76 | abort: bookmark name required |
|
76 | abort: bookmark name required | |
|
77 | % bookmark name with whitespace only | |||
|
78 | abort: bookmark names cannot consist entirely of whitespace |
@@ -109,3 +109,19 b' hg up -C' | |||||
109 | hg qimport --push another.diff |
|
109 | hg qimport --push another.diff | |
110 | hg qfin -a |
|
110 | hg qfin -a | |
111 | hg qimport -rtip -P |
|
111 | hg qimport -rtip -P | |
|
112 | ||||
|
113 | hg qpop -a | |||
|
114 | hg qdel -k 2.diff | |||
|
115 | echo % qimport -e | |||
|
116 | hg qimport -e 2.diff | |||
|
117 | hg qdel -k 2.diff | |||
|
118 | echo % qimport -e --name newname oldexisitingpatch | |||
|
119 | hg qimport -e --name this-name-is-better 2.diff | |||
|
120 | hg qser | |||
|
121 | echo % qimport -e --name without --force | |||
|
122 | cp .hg/patches/this-name-is-better .hg/patches/3.diff | |||
|
123 | hg qimport -e --name this-name-is-better 3.diff | |||
|
124 | hg qser | |||
|
125 | echo % qimport -e --name with --force | |||
|
126 | hg qimport --force -e --name this-name-is-better 3.diff | |||
|
127 | hg qser |
@@ -52,3 +52,21 b' applying another.diff' | |||||
52 | now at: another.diff |
|
52 | now at: another.diff | |
53 | patch b.diff finalized without changeset message |
|
53 | patch b.diff finalized without changeset message | |
54 | patch another.diff finalized without changeset message |
|
54 | patch another.diff finalized without changeset message | |
|
55 | popping 2.diff | |||
|
56 | patch queue now empty | |||
|
57 | % qimport -e | |||
|
58 | adding 2.diff to series file | |||
|
59 | % qimport -e --name newname oldexisitingpatch | |||
|
60 | renaming 2.diff to this-name-is-better | |||
|
61 | adding this-name-is-better to series file | |||
|
62 | this-name-is-better | |||
|
63 | url.diff | |||
|
64 | % qimport -e --name without --force | |||
|
65 | abort: patch "this-name-is-better" already exists | |||
|
66 | this-name-is-better | |||
|
67 | url.diff | |||
|
68 | % qimport -e --name with --force | |||
|
69 | renaming 3.diff to this-name-is-better | |||
|
70 | adding this-name-is-better to series file | |||
|
71 | this-name-is-better | |||
|
72 | url.diff |
@@ -110,6 +110,7 b" log 'heads(6::)'" | |||||
110 | log 'keyword(issue)' |
|
110 | log 'keyword(issue)' | |
111 | log 'limit(head(), 1)' |
|
111 | log 'limit(head(), 1)' | |
112 | log 'max(contains(a))' |
|
112 | log 'max(contains(a))' | |
|
113 | log 'min(contains(a))' | |||
113 | log 'merge()' |
|
114 | log 'merge()' | |
114 | log 'modifies(b)' |
|
115 | log 'modifies(b)' | |
115 | log 'p1(merge())' |
|
116 | log 'p1(merge())' |
General Comments 0
You need to be logged in to leave comments.
Login now