Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 42365:d8e55c0c642c
util: make util.dirs() and util.finddirs() include root directory (API)
This changes the behavior of test-origbackup-conflict.t so it no
longer errors out when the backup path points to an existing
file. Instead, it replaces the file by a directory. That seems
reasonable to me.
Differential Revision: https://phab.mercurial-scm.org/D6403
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 16 May 2017 11:00:38 -0700 |
parents | 3e47d1ec9da5 |
children | 2db96bf84a8f |
comparison
equal
deleted
inserted
replaced
42364:448486e12c13 | 42365:d8e55c0c642c |
---|---|
3207 def finddirs(path): | 3207 def finddirs(path): |
3208 pos = path.rfind('/') | 3208 pos = path.rfind('/') |
3209 while pos != -1: | 3209 while pos != -1: |
3210 yield path[:pos] | 3210 yield path[:pos] |
3211 pos = path.rfind('/', 0, pos) | 3211 pos = path.rfind('/', 0, pos) |
3212 yield '' | |
3212 | 3213 |
3213 | 3214 |
3214 # convenient shortcut | 3215 # convenient shortcut |
3215 dst = debugstacktrace | 3216 dst = debugstacktrace |
3216 | 3217 |