Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHGfff5942d445f: typo: s/unkown/unknown across the codebase
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
pulkit |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/bundle2.py (2 lines) | |||
M | mercurial/merge.py (14 lines) | |||
M | mercurial/obsutil.py (2 lines) | |||
M | setup.py (2 lines) | |||
M | tests/test-purge.t (8 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
1ddd181729e4 | 8b927b33310a | Raphaël Gomès | Nov 26 2021, 5:53 AM |
op.repo._afterlock(runhook) | op.repo._afterlock(runhook) | ||||
elif bookmarksmode == b'records': | elif bookmarksmode == b'records': | ||||
for book, node in changes: | for book, node in changes: | ||||
record = {b'bookmark': book, b'node': node} | record = {b'bookmark': book, b'node': node} | ||||
op.records.add(b'bookmarks', record) | op.records.add(b'bookmarks', record) | ||||
else: | else: | ||||
raise error.ProgrammingError( | raise error.ProgrammingError( | ||||
b'unkown bookmark mode: %s' % bookmarksmode | b'unknown bookmark mode: %s' % bookmarksmode | ||||
) | ) | ||||
@parthandler(b'phase-heads') | @parthandler(b'phase-heads') | ||||
def handlephases(op, inpart): | def handlephases(op, inpart): | ||||
"""apply phases from bundle part to repo""" | """apply phases from bundle part to repo""" | ||||
headsbyphase = phases.binarydecode(inpart) | headsbyphase = phases.binarydecode(inpart) | ||||
phases.updatephases(op.repo.unfiltered(), op.gettransaction, headsbyphase) | phases.updatephases(op.repo.unfiltered(), op.gettransaction, headsbyphase) |
if removeemptydirs: | if removeemptydirs: | ||||
directories = [] | directories = [] | ||||
matcher.traversedir = directories.append | matcher.traversedir = directories.append | ||||
status = repo.status(match=matcher, ignored=ignored, unknown=unknown) | status = repo.status(match=matcher, ignored=ignored, unknown=unknown) | ||||
if confirm: | if confirm: | ||||
nb_ignored = len(status.ignored) | nb_ignored = len(status.ignored) | ||||
nb_unkown = len(status.unknown) | nb_unknown = len(status.unknown) | ||||
if nb_unkown and nb_ignored: | if nb_unknown and nb_ignored: | ||||
msg = _(b"permanently delete %d unkown and %d ignored files?") | msg = _(b"permanently delete %d unknown and %d ignored files?") | ||||
msg %= (nb_unkown, nb_ignored) | msg %= (nb_unknown, nb_ignored) | ||||
elif nb_unkown: | elif nb_unknown: | ||||
msg = _(b"permanently delete %d unkown files?") | msg = _(b"permanently delete %d unknown files?") | ||||
msg %= nb_unkown | msg %= nb_unknown | ||||
elif nb_ignored: | elif nb_ignored: | ||||
msg = _(b"permanently delete %d ignored files?") | msg = _(b"permanently delete %d ignored files?") | ||||
msg %= nb_ignored | msg %= nb_ignored | ||||
elif removeemptydirs: | elif removeemptydirs: | ||||
dir_count = 0 | dir_count = 0 | ||||
for f in directories: | for f in directories: | ||||
if matcher(f) and not repo.wvfs.listdir(f): | if matcher(f) and not repo.wvfs.listdir(f): | ||||
dir_count += 1 | dir_count += 1 |
For example: | For example: | ||||
# (A0 rewritten as A1) | # (A0 rewritten as A1) | ||||
# | # | ||||
# A0 <-1- A1 # Marker "1" is exclusive to A1 | # A0 <-1- A1 # Marker "1" is exclusive to A1 | ||||
or | or | ||||
# (A0 rewritten as AX; AX rewritten as A1; AX is unkown locally) | # (A0 rewritten as AX; AX rewritten as A1; AX is unknown locally) | ||||
# | # | ||||
# <-1- A0 <-2- AX <-3- A1 # Marker "2,3" are exclusive to A1 | # <-1- A0 <-2- AX <-3- A1 # Marker "2,3" are exclusive to A1 | ||||
or | or | ||||
# (A0 has unknown precursors, A0 rewritten as A1 and A2 (divergence)) | # (A0 has unknown precursors, A0 rewritten as A1 and A2 (divergence)) | ||||
# | # | ||||
# <-2- A1 # Marker "2" is exclusive to A0,A1 | # <-2- A1 # Marker "2" is exclusive to A0,A1 |
def parse_command_line(self): | def parse_command_line(self): | ||||
ret = Distribution.parse_command_line(self) | ret = Distribution.parse_command_line(self) | ||||
if not (self.rust or self.no_rust): | if not (self.rust or self.no_rust): | ||||
hgrustext = os.environ.get('HGWITHRUSTEXT') | hgrustext = os.environ.get('HGWITHRUSTEXT') | ||||
# TODO record it for proper rebuild upon changes | # TODO record it for proper rebuild upon changes | ||||
# (see mercurial/__modulepolicy__.py) | # (see mercurial/__modulepolicy__.py) | ||||
if hgrustext != 'cpython' and hgrustext is not None: | if hgrustext != 'cpython' and hgrustext is not None: | ||||
if hgrustext: | if hgrustext: | ||||
msg = 'unkown HGWITHRUSTEXT value: %s' % hgrustext | msg = 'unknown HGWITHRUSTEXT value: %s' % hgrustext | ||||
printf(msg, file=sys.stderr) | printf(msg, file=sys.stderr) | ||||
hgrustext = None | hgrustext = None | ||||
self.rust = hgrustext is not None | self.rust = hgrustext is not None | ||||
self.no_rust = not self.rust | self.no_rust = not self.rust | ||||
return ret | return ret | ||||
def has_ext_modules(self): | def has_ext_modules(self): | ||||
# self.ext_modules is emptied in hgbuildpy.finalize_options which is | # self.ext_modules is emptied in hgbuildpy.finalize_options which is |
$ echo 'ignored' > .hgignore | $ echo 'ignored' > .hgignore | ||||
$ hg ci -qAmr3 -d'2 0' | $ hg ci -qAmr3 -d'2 0' | ||||
purge without the extension | purge without the extension | ||||
$ hg st | $ hg st | ||||
$ touch foo | $ touch foo | ||||
$ hg purge | $ hg purge | ||||
permanently delete 1 unkown files? (yN) n | permanently delete 1 unknown files? (yN) n | ||||
abort: removal cancelled | abort: removal cancelled | ||||
[250] | [250] | ||||
$ hg st | $ hg st | ||||
? foo | ? foo | ||||
$ hg purge --no-confirm | $ hg purge --no-confirm | ||||
$ hg st | $ hg st | ||||
now enabling the extension | now enabling the extension | ||||
> import stat | > import stat | ||||
> f = 'untracked_file_readonly' | > f = 'untracked_file_readonly' | ||||
> os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) | > os.chmod(f, stat.S_IMODE(os.stat(f).st_mode) & ~stat.S_IWRITE) | ||||
> EOF | > EOF | ||||
$ hg purge -p | $ hg purge -p | ||||
untracked_file | untracked_file | ||||
untracked_file_readonly | untracked_file_readonly | ||||
$ hg purge --confirm | $ hg purge --confirm | ||||
permanently delete 2 unkown files? (yN) n | permanently delete 2 unknown files? (yN) n | ||||
abort: removal cancelled | abort: removal cancelled | ||||
[250] | [250] | ||||
$ hg purge -v | $ hg purge -v | ||||
removing file untracked_file | removing file untracked_file | ||||
removing file untracked_file_readonly | removing file untracked_file_readonly | ||||
$ ls -A | $ ls -A | ||||
.hg | .hg | ||||
.hgignore | .hgignore | ||||
delete only part of the tree | delete only part of the tree | ||||
$ mkdir -p untracked_directory/nested_directory | $ mkdir -p untracked_directory/nested_directory | ||||
$ touch directory/untracked_file | $ touch directory/untracked_file | ||||
$ cd directory | $ cd directory | ||||
$ hg purge -p ../untracked_directory | $ hg purge -p ../untracked_directory | ||||
untracked_directory/nested_directory | untracked_directory/nested_directory | ||||
$ hg purge --confirm | $ hg purge --confirm | ||||
permanently delete 1 unkown files? (yN) n | permanently delete 1 unknown files? (yN) n | ||||
abort: removal cancelled | abort: removal cancelled | ||||
[250] | [250] | ||||
$ hg purge -v ../untracked_directory | $ hg purge -v ../untracked_directory | ||||
removing directory untracked_directory/nested_directory | removing directory untracked_directory/nested_directory | ||||
removing directory untracked_directory | removing directory untracked_directory | ||||
$ cd .. | $ cd .. | ||||
$ ls -A | $ ls -A | ||||
.hg | .hg | ||||
directory | directory | ||||
r1 | r1 | ||||
untracked_file | untracked_file | ||||
$ touch ignored | $ touch ignored | ||||
$ hg purge -p --all | $ hg purge -p --all | ||||
ignored | ignored | ||||
untracked_file | untracked_file | ||||
$ hg purge --confirm --all | $ hg purge --confirm --all | ||||
permanently delete 1 unkown and 1 ignored files? (yN) n | permanently delete 1 unknown and 1 ignored files? (yN) n | ||||
abort: removal cancelled | abort: removal cancelled | ||||
[250] | [250] | ||||
$ hg purge -v --all | $ hg purge -v --all | ||||
removing file ignored | removing file ignored | ||||
removing file untracked_file | removing file untracked_file | ||||
$ ls | $ ls | ||||
directory | directory | ||||
r1 | r1 |