Show More
@@ -33,6 +33,7 b' from . import (' | |||||
33 | mdiff, |
|
33 | mdiff, | |
34 | obsolete as obsmod, |
|
34 | obsolete as obsmod, | |
35 | patch, |
|
35 | patch, | |
|
36 | pathutil, | |||
36 | phases, |
|
37 | phases, | |
37 | pycompat, |
|
38 | pycompat, | |
38 | repoview, |
|
39 | repoview, | |
@@ -1518,17 +1519,20 b' class workingctx(committablectx):' | |||||
1518 | (missing and self.deleted())) |
|
1519 | (missing and self.deleted())) | |
1519 |
|
1520 | |||
1520 | def add(self, list, prefix=""): |
|
1521 | def add(self, list, prefix=""): | |
1521 | join = lambda f: os.path.join(prefix, f) |
|
|||
1522 | with self._repo.wlock(): |
|
1522 | with self._repo.wlock(): | |
1523 | ui, ds = self._repo.ui, self._repo.dirstate |
|
1523 | ui, ds = self._repo.ui, self._repo.dirstate | |
|
1524 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) | |||
1524 | rejected = [] |
|
1525 | rejected = [] | |
1525 | lstat = self._repo.wvfs.lstat |
|
1526 | lstat = self._repo.wvfs.lstat | |
1526 | for f in list: |
|
1527 | for f in list: | |
1527 | scmutil.checkportable(ui, join(f)) |
|
1528 | # ds.pathto() returns an absolute file when this is invoked from | |
|
1529 | # the keyword extension. That gets flagged as non-portable on | |||
|
1530 | # Windows, since it contains the drive letter and colon. | |||
|
1531 | scmutil.checkportable(ui, os.path.join(prefix, f)) | |||
1528 | try: |
|
1532 | try: | |
1529 | st = lstat(f) |
|
1533 | st = lstat(f) | |
1530 | except OSError: |
|
1534 | except OSError: | |
1531 |
ui.warn(_("%s does not exist!\n") % |
|
1535 | ui.warn(_("%s does not exist!\n") % uipath(f)) | |
1532 | rejected.append(f) |
|
1536 | rejected.append(f) | |
1533 | continue |
|
1537 | continue | |
1534 | if st.st_size > 10000000: |
|
1538 | if st.st_size > 10000000: | |
@@ -1536,13 +1540,13 b' class workingctx(committablectx):' | |||||
1536 | "to manage this file\n" |
|
1540 | "to manage this file\n" | |
1537 | "(use 'hg revert %s' to cancel the " |
|
1541 | "(use 'hg revert %s' to cancel the " | |
1538 | "pending addition)\n") |
|
1542 | "pending addition)\n") | |
1539 |
|
|
1543 | % (f, 3 * st.st_size // 1000000, uipath(f))) | |
1540 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1544 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
1541 | ui.warn(_("%s not added: only files and symlinks " |
|
1545 | ui.warn(_("%s not added: only files and symlinks " | |
1542 |
"supported currently\n") % |
|
1546 | "supported currently\n") % uipath(f)) | |
1543 | rejected.append(f) |
|
1547 | rejected.append(f) | |
1544 | elif ds[f] in 'amn': |
|
1548 | elif ds[f] in 'amn': | |
1545 |
ui.warn(_("%s already tracked!\n") % |
|
1549 | ui.warn(_("%s already tracked!\n") % uipath(f)) | |
1546 | elif ds[f] == 'r': |
|
1550 | elif ds[f] == 'r': | |
1547 | ds.normallookup(f) |
|
1551 | ds.normallookup(f) | |
1548 | else: |
|
1552 | else: | |
@@ -1550,12 +1554,13 b' class workingctx(committablectx):' | |||||
1550 | return rejected |
|
1554 | return rejected | |
1551 |
|
1555 | |||
1552 | def forget(self, files, prefix=""): |
|
1556 | def forget(self, files, prefix=""): | |
1553 | join = lambda f: os.path.join(prefix, f) |
|
|||
1554 | with self._repo.wlock(): |
|
1557 | with self._repo.wlock(): | |
|
1558 | ds = self._repo.dirstate | |||
|
1559 | uipath = lambda f: ds.pathto(pathutil.join(prefix, f)) | |||
1555 | rejected = [] |
|
1560 | rejected = [] | |
1556 | for f in files: |
|
1561 | for f in files: | |
1557 | if f not in self._repo.dirstate: |
|
1562 | if f not in self._repo.dirstate: | |
1558 |
self._repo.ui.warn(_("%s not tracked!\n") % |
|
1563 | self._repo.ui.warn(_("%s not tracked!\n") % uipath(f)) | |
1559 | rejected.append(f) |
|
1564 | rejected.append(f) | |
1560 | elif self._repo.dirstate[f] != 'a': |
|
1565 | elif self._repo.dirstate[f] != 'a': | |
1561 | self._repo.dirstate.remove(f) |
|
1566 | self._repo.dirstate.remove(f) | |
@@ -1566,9 +1571,10 b' class workingctx(committablectx):' | |||||
1566 | def undelete(self, list): |
|
1571 | def undelete(self, list): | |
1567 | pctxs = self.parents() |
|
1572 | pctxs = self.parents() | |
1568 | with self._repo.wlock(): |
|
1573 | with self._repo.wlock(): | |
|
1574 | ds = self._repo.dirstate | |||
1569 | for f in list: |
|
1575 | for f in list: | |
1570 | if self._repo.dirstate[f] != 'r': |
|
1576 | if self._repo.dirstate[f] != 'r': | |
1571 | self._repo.ui.warn(_("%s not removed!\n") % f) |
|
1577 | self._repo.ui.warn(_("%s not removed!\n") % ds.pathto(f)) | |
1572 | else: |
|
1578 | else: | |
1573 | fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f] |
|
1579 | fctx = f in pctxs[0] and pctxs[0][f] or pctxs[1][f] | |
1574 | t = fctx.data() |
|
1580 | t = fctx.data() | |
@@ -1581,11 +1587,13 b' class workingctx(committablectx):' | |||||
1581 | except OSError as err: |
|
1587 | except OSError as err: | |
1582 | if err.errno != errno.ENOENT: |
|
1588 | if err.errno != errno.ENOENT: | |
1583 | raise |
|
1589 | raise | |
1584 |
self._repo.ui.warn(_("%s does not exist!\n") |
|
1590 | self._repo.ui.warn(_("%s does not exist!\n") | |
|
1591 | % self._repo.dirstate.pathto(dest)) | |||
1585 | return |
|
1592 | return | |
1586 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): |
|
1593 | if not (stat.S_ISREG(st.st_mode) or stat.S_ISLNK(st.st_mode)): | |
1587 | self._repo.ui.warn(_("copy failed: %s is not a file or a " |
|
1594 | self._repo.ui.warn(_("copy failed: %s is not a file or a " | |
1588 |
"symbolic link\n") |
|
1595 | "symbolic link\n") | |
|
1596 | % self._repo.dirstate.pathto(dest)) | |||
1589 | else: |
|
1597 | else: | |
1590 | with self._repo.wlock(): |
|
1598 | with self._repo.wlock(): | |
1591 | if self._repo.dirstate[dest] in '?': |
|
1599 | if self._repo.dirstate[dest] in '?': |
General Comments 0
You need to be logged in to leave comments.
Login now