Show More
@@ -136,6 +136,9 b' def bookmark(ui, repo, mark=None, rev=No' | |||
|
136 | 136 | if "\n" in mark: |
|
137 | 137 | raise util.Abort(_("bookmark name cannot contain newlines")) |
|
138 | 138 | mark = mark.strip() |
|
139 | if not mark: | |
|
140 | raise util.Abort(_("bookmark names cannot consist entirely of " | |
|
141 | "whitespace")) | |
|
139 | 142 | if mark in marks and not force: |
|
140 | 143 | raise util.Abort(_("a bookmark of the same name already exists")) |
|
141 | 144 | if ((mark in repo.branchtags() or mark == repo.dirstate.branch()) |
@@ -1687,11 +1687,22 b' class queue(object):' | |||
|
1687 | 1687 | if existing: |
|
1688 | 1688 | if filename == '-': |
|
1689 | 1689 | raise util.Abort(_('-e is incompatible with import from -')) |
|
1690 | if not patchname: | |
|
1691 |
|
|
|
1692 | self.check_reserved_name(patchname) | |
|
1693 |
if not os.path.isfile( |
|
|
1694 |
raise util.Abort(_("patch %s does not exist") % |
|
|
1690 | filename = normname(filename) | |
|
1691 | self.check_reserved_name(filename) | |
|
1692 | originpath = self.join(filename) | |
|
1693 | if not os.path.isfile(originpath): | |
|
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 | 1706 | else: |
|
1696 | 1707 | try: |
|
1697 | 1708 | if filename == '-': |
@@ -1806,6 +1817,10 b' def qimport(ui, repo, *filename, **opts)' | |||
|
1806 | 1817 | To import a patch from standard input, pass - as the patch file. |
|
1807 | 1818 | When importing from standard input, a patch name must be specified |
|
1808 | 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 | 1825 | q = repo.mq |
|
1811 | 1826 | try: |
@@ -352,12 +352,12 b' class filectx(object):' | |||
|
352 | 352 | def size(self): |
|
353 | 353 | return self._filelog.size(self._filerev) |
|
354 | 354 | |
|
355 |
def cmp(self, t |
|
|
356 |
"""compare |
|
|
355 | def cmp(self, fctx): | |
|
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 | 362 | def renamed(self): |
|
363 | 363 | """check if file was actually renamed in this changeset revision |
@@ -935,12 +935,14 b' class workingfilectx(filectx):' | |||
|
935 | 935 | raise |
|
936 | 936 | return (t, tz) |
|
937 | 937 | |
|
938 |
def cmp(self, t |
|
|
939 |
"""compare |
|
|
938 | def cmp(self, fctx): | |
|
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 | 947 | class memctx(object): |
|
946 | 948 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
@@ -135,7 +135,7 b' def filemerge(repo, mynode, orig, fcd, f' | |||
|
135 | 135 | except IOError: |
|
136 | 136 | return False |
|
137 | 137 | |
|
138 |
if not fco.cmp(fcd |
|
|
138 | if not fco.cmp(fcd): # files identical? | |
|
139 | 139 | return None |
|
140 | 140 | |
|
141 | 141 | if fca == fco: # backwards, use working dir parent as ancestor |
@@ -100,6 +100,9 b' The following predicates are supported:' | |||
|
100 | 100 | ``max(set)`` |
|
101 | 101 | Changeset with highest revision number in set. |
|
102 | 102 | |
|
103 | ``min(set)`` | |
|
104 | Changeset with lowest revision number in set. | |
|
105 | ||
|
103 | 106 | ``merge()`` |
|
104 | 107 | Changeset is a merge changeset. |
|
105 | 108 |
@@ -510,7 +510,7 b' class localrepository(repo.repository):' | |||
|
510 | 510 | def _link(self, f): |
|
511 | 511 | return os.path.islink(self.wjoin(f)) |
|
512 | 512 | |
|
513 |
def _filter(self, filter |
|
|
513 | def _loadfilter(self, filter): | |
|
514 | 514 | if filter not in self.filterpats: |
|
515 | 515 | l = [] |
|
516 | 516 | for pat, cmd in self.ui.configitems(filter): |
@@ -533,6 +533,9 b' class localrepository(repo.repository):' | |||
|
533 | 533 | l.append((mf, fn, params)) |
|
534 | 534 | self.filterpats[filter] = l |
|
535 | 535 | |
|
536 | def _filter(self, filter, filename, data): | |
|
537 | self._loadfilter(filter) | |
|
538 | ||
|
536 | 539 | for mf, fn, cmd in self.filterpats[filter]: |
|
537 | 540 | if mf(filename): |
|
538 | 541 | self.ui.debug("filtering %s through %s\n" % (filename, cmd)) |
@@ -1059,7 +1062,7 b' class localrepository(repo.repository):' | |||
|
1059 | 1062 | # do a full compare of any files that might have changed |
|
1060 | 1063 | for f in sorted(cmp): |
|
1061 | 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 | 1066 | modified.append(f) |
|
1064 | 1067 | else: |
|
1065 | 1068 | fixup.append(f) |
@@ -1103,7 +1106,7 b' class localrepository(repo.repository):' | |||
|
1103 | 1106 | if fn in mf1: |
|
1104 | 1107 | if (mf1.flags(fn) != mf2.flags(fn) or |
|
1105 | 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 | 1110 | modified.append(fn) |
|
1108 | 1111 | elif listclean: |
|
1109 | 1112 | clean.append(fn) |
@@ -73,7 +73,7 b' class mergestate(object):' | |||
|
73 | 73 | def _checkunknown(wctx, mctx): |
|
74 | 74 | "check for collisions between unknown files and files in mctx" |
|
75 | 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 | 77 | raise util.Abort(_("untracked file in working directory differs" |
|
78 | 78 | " from file in requested revision: '%s'") % f) |
|
79 | 79 |
@@ -195,6 +195,14 b' def maxrev(repo, subset, x):' | |||
|
195 | 195 | return [m] |
|
196 | 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 | 206 | def limit(repo, subset, x): |
|
199 | 207 | l = getargs(x, 2, 2, _("limit wants two arguments")) |
|
200 | 208 | try: |
@@ -466,6 +474,7 b' symbols = {' | |||
|
466 | 474 | "keyword": keyword, |
|
467 | 475 | "limit": limit, |
|
468 | 476 | "max": maxrev, |
|
477 | "min": minrev, | |
|
469 | 478 | "merge": merge, |
|
470 | 479 | "modifies": modifies, |
|
471 | 480 | "outgoing": outgoing, |
@@ -100,4 +100,7 b' hg bookmark' | |||
|
100 | 100 | echo % revision but no bookmark name |
|
101 | 101 | hg bookmark -r . |
|
102 | 102 | |
|
103 | echo % bookmark name with whitespace only | |
|
104 | hg bookmark ' ' | |
|
105 | ||
|
103 | 106 | true |
@@ -74,3 +74,5 b' abort: a bookmark of the same name alrea' | |||
|
74 | 74 | * x y 2:0316ce92851d |
|
75 | 75 | % revision but no bookmark name |
|
76 | 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 | 109 | hg qimport --push another.diff |
|
110 | 110 | hg qfin -a |
|
111 | 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 | 52 | now at: another.diff |
|
53 | 53 | patch b.diff finalized without changeset message |
|
54 | 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 |
General Comments 0
You need to be logged in to leave comments.
Login now