by
Changes to 9 files · Browse files at eacaa46c6eae Showing diff from parent 0524579d8c04 49d1b27ed01a Diff from another changeset...
|
|
@@ -6,6 +6,7 @@ # GNU General Public License version 2, incorporated herein by reference.
import os
+import re
from mercurial import error, match, patch, util, mdiff
from mercurial import ui as uimod
@@ -47,7 +48,7 @@ return None
try:
data = fctx.data()
- if '\0' in data:
+ if '\0' in data or re.match(r'^\.kbf/', wfile):
self.error = p + _('File is binary.\n')
return None
except (EnvironmentError, util.Abort), e:
@@ -72,6 +73,7 @@ return 'C'
return None
+ isbfile = False
repo = ctx._repo
self.flabel += u'<b>%s</b>' % hglib.tounicode(wfile)
@@ -301,6 +303,9 @@ else:
self.contents = olddata
self.flabel += _(' <i>(was deleted)</i>')
+ elif '.kbf/' + wfile in ctx.p1():
+ self.error = 'binary file'
+ self.flabel += _(' <i>(was deleted)</i>')
else:
self.flabel += _(' <i>(was added, now missing)</i>')
return
@@ -323,6 +328,9 @@ return
if status in ('M', 'A'):
+ if '.kbf/' + wfile in ctx:
+ wfile = '.kbf/' + wfile
+ isbfile = True
res = self.checkMaxDiff(ctx, wfile, maxdiff)
if res is None:
return
@@ -364,5 +372,8 @@ revs = [str(ctx), str(ctx2)]
diffopts = patch.diffopts(repo.ui, {})
diffopts.git = False
+ if isbfile:
+ olddata += '\0'
+ newdata += '\0'
self.diff = mdiff.unidiff(olddata, olddate, newdata, newdate,
oldname, wfile, revs, diffopts)
|
@@ -14,6 +14,8 @@ # this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+import re
+
from tortoisehg.util import hglib, patchctx
from tortoisehg.hgqt.qtlib import geticon, getoverlaidicon
@@ -144,6 +146,7 @@ for lst, flag in ((added, 'A'), (modified, 'M'), (removed, 'R')):
for f in filter(func, lst):
wasmerged = ismerge and f in ctxfiles
+ f = re.sub(r'^\.kbf/', '', f)
files.append({'path': f, 'status': flag, 'parent': parent,
'wasmerged': wasmerged})
return files
|
@@ -136,9 +136,12 @@ parent=self)
return
if self.command == 'remove':
- wctx = self.repo[None]
+ self.repo.bfstatus = True
+ repostate = self.repo.status()
+ self.repo.bfstatus = False
+ unknown, ignored = repostate[4:6]
for wfile in files:
- if wfile not in wctx:
+ if wfile in unknown or wfile in ignored:
try:
util.unlink(wfile)
except EnvironmentError:
|
@@ -413,7 +413,9 @@ # status and commit only pre-check MAR files
precheckfn = lambda x: x < 4
m = hglib.match(self.repo[None], self.pats)
+ self.repo.bfstatus = True
status = self.repo.status(match=m, **stopts)
+ self.repo.bfstatus = False
# Record all matched files as initially checked
for i, stat in enumerate(StatusType.preferredOrder):
if stat == 'S':
@@ -425,11 +427,15 @@ wctx = context.workingctx(self.repo, changes=status)
self.patchecked = patchecked
elif self.pctx:
+ self.repo.bfstatus = True
status = self.repo.status(node1=self.pctx.p1().node(), **stopts)
+ self.repo.bfstatus = False
wctx = context.workingctx(self.repo, changes=status)
else:
wctx = self.repo[None]
+ self.repo.bfstatus = True
wctx.status(**stopts)
+ self.repo.bfstatus = False
self.wctx = wctx
wctx.dirtySubrepos = []
|
@@ -90,7 +90,9 @@ time.sleep(tdelta)
repo = hg.repository(ui, root) # a fresh repo object is needed
+ repo.bfstatus = True
repostate = repo.status() # will update .hg/dirstate as a side effect
+ repo.bfstatus = False
modified, added, removed, deleted = repostate[:4]
dirstatus = {}
|
@@ -31,7 +31,8 @@
Dirstate* Dirstatecache::get(
- const std::string& hgroot, const std::string& cwd, bool& unset)
+ const std::string& hgroot, const std::string& cwd, bool& unset,
+ bool usekbfiles)
{
unset = false;
@@ -40,12 +41,13 @@ Iter iter = cache().begin();
for (;iter != cache().end(); ++iter)
{
- if (hgroot == iter->hgroot)
+ if (hgroot == iter->hgroot && usekbfiles == iter->usekbfiles)
break;
}
Winstat64 stat;
- std::string path = hgroot + "\\.hg\\dirstate";
+ std::string path = hgroot + (usekbfiles ? "\\.hg\\kilnbfiles\\dirstate"
+ : "\\.hg\\dirstate");
unsigned tc = GetTickCount();
bool new_stat = false;
@@ -71,6 +73,7 @@
E e;
e.hgroot = hgroot;
+ e.usekbfiles = usekbfiles;
cache().push_front(e);
iter = cache().begin();
iter->tickcount = tc;
@@ -159,7 +162,7 @@}
-void Dirstatecache::invalidate(const std::string& hgroot)
+void Dirstatecache::invalidate(const std::string& hgroot, bool usekbfiles)
{
typedef std::list<E>::iterator Iter;
@@ -168,7 +171,7 @@
for (Iter i = cache().begin(); i != cache().end(); ++i)
{
- if (hgroot == i->hgroot)
+ if (hgroot == i->hgroot && usekbfiles == i->usekbfiles)
{
delete i->dstate;
i->dstate = 0;
|
@@ -34,13 +34,15 @@ std::string hgroot;
unsigned tickcount;
bool unset;
+ bool usekbfiles;
E():
dstate(0),
dstate_mtime(0),
dstate_size(0),
tickcount(0),
- unset(false)
+ unset(false),
+ usekbfiles(false)
{}
};
@@ -48,8 +50,9 @@
public:
static Dirstate* get(
- const std::string& hgroot, const std::string& cwd, bool& unset);
- static void invalidate(const std::string& hgroot);
+ const std::string& hgroot, const std::string& cwd, bool& unset,
+ bool usekbfiles = false);
+ static void invalidate(const std::string& hgroot, bool usekbfiles = false);
};
#endif
|
@@ -83,9 +83,9 @@ {
std::string p = cur.path;
p.push_back('\\');
- if (p.find("\\.hg\\") != std::string::npos)
+ if (p.find("\\.hg\\") != std::string::npos || p.find("\\.kbf\\") != std::string::npos)
{
- // ignore files and dirs named '.hg'
+ // ignore files and dirs named '.hg' or '.kbf'
last = cur;
return 0;
}
@@ -301,8 +301,13 @@ {
if (!relpath.empty() && !pds->root().getdir(relpath))
{
- last = cur;
- return 0; // unknown dir -> no icon
+ // attempt to get status from kbfiles
+ pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true);
+ if (!pds || !pds->root().getdir(relpath))
+ {
+ last = cur;
+ return 0; // unknown dir -> no icon
+ }
}
outStatus = (pdirsta ? pdirsta->status(relpath) : '?');
@@ -312,11 +317,20 @@ return 1;
}
- const Direntry* const e = pds->root().get(relpath);
+ const Direntry* e = pds->root().get(relpath);
if (!e)
{
- last = cur;
- return 0;
+ // attempt to get status from kbfiles
+ pds = Dirstatecache::get(cur.hgroot, cur.basedir, unset, true);
+ if (pds)
+ {
+ e = pds->root().get(relpath);
+ }
+ if (!e)
+ {
+ last = cur;
+ return 0;
+ }
}
outStatus = e->status(stat);
|
Loading...