Show More
@@ -509,7 +509,7 b' SPECIFYING MULTIPLE REVISIONS' | |||||
509 | If BEGIN is greater than END, revisions are treated in reverse |
|
509 | If BEGIN is greater than END, revisions are treated in reverse | |
510 | order. |
|
510 | order. | |
511 |
|
511 | |||
512 |
A range acts as a |
|
512 | A range acts as a closed interval. This means that a range of 3:5 | |
513 | gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2. |
|
513 | gives 3, 4 and 5. Similarly, a range of 4:2 gives 4, 3, and 2. | |
514 |
|
514 | |||
515 | ENVIRONMENT VARIABLES |
|
515 | ENVIRONMENT VARIABLES |
@@ -10,7 +10,7 b' import util' | |||||
10 | from revlog import * |
|
10 | from revlog import * | |
11 | from demandload import * |
|
11 | from demandload import * | |
12 | demandload(globals(), "re lock urllib urllib2 transaction time socket") |
|
12 | demandload(globals(), "re lock urllib urllib2 transaction time socket") | |
13 | demandload(globals(), "tempfile httprangereader bdiff urlparse") |
|
13 | demandload(globals(), "tempfile httprangereader bdiff urlparse stat") | |
14 | demandload(globals(), "bisect select") |
|
14 | demandload(globals(), "bisect select") | |
15 |
|
15 | |||
16 | class filelog(revlog): |
|
16 | class filelog(revlog): | |
@@ -392,7 +392,7 b' class dirstate:' | |||||
392 | def copied(self, file): |
|
392 | def copied(self, file): | |
393 | return self.copies.get(file, None) |
|
393 | return self.copies.get(file, None) | |
394 |
|
394 | |||
395 | def update(self, files, state): |
|
395 | def update(self, files, state, **kw): | |
396 | ''' current states: |
|
396 | ''' current states: | |
397 | n normal |
|
397 | n normal | |
398 | m needs merging |
|
398 | m needs merging | |
@@ -407,7 +407,9 b' class dirstate:' | |||||
407 | self.map[f] = ('r', 0, 0, 0) |
|
407 | self.map[f] = ('r', 0, 0, 0) | |
408 | else: |
|
408 | else: | |
409 | s = os.stat(os.path.join(self.root, f)) |
|
409 | s = os.stat(os.path.join(self.root, f)) | |
410 |
se |
|
410 | st_size = kw.get('st_size', s.st_size) | |
|
411 | st_mtime = kw.get('st_mtime', s.st_mtime) | |||
|
412 | self.map[f] = (state, s.st_mode, st_size, st_mtime) | |||
411 |
|
413 | |||
412 | def forget(self, files): |
|
414 | def forget(self, files): | |
413 | if not files: return |
|
415 | if not files: return | |
@@ -484,33 +486,41 b' class dirstate:' | |||||
484 | if match(fn): |
|
486 | if match(fn): | |
485 | yield src, fn |
|
487 | yield src, fn | |
486 |
|
488 | |||
487 |
def changes(self, files |
|
489 | def changes(self, files=None, match=util.always): | |
488 | self.read() |
|
490 | self.read() | |
489 | dc = self.map.copy() |
|
491 | dc = self.map.copy() | |
490 |
lookup, |
|
492 | lookup, modified, added, unknown = [], [], [], [] | |
|
493 | removed, deleted = [], [] | |||
491 |
|
494 | |||
492 | for src, fn in self.walk(files, match): |
|
495 | for src, fn in self.walk(files, match): | |
493 | try: s = os.stat(os.path.join(self.root, fn)) |
|
496 | try: | |
494 | except: continue |
|
497 | s = os.stat(os.path.join(self.root, fn)) | |
495 |
|
498 | except OSError: | ||
496 |
|
|
499 | continue | |
497 | c = dc[fn] |
|
500 | if not stat.S_ISREG(s.st_mode): | |
|
501 | continue | |||
|
502 | c = dc.get(fn) | |||
|
503 | if c: | |||
498 | del dc[fn] |
|
504 | del dc[fn] | |
499 |
|
||||
500 | if c[0] == 'm': |
|
505 | if c[0] == 'm': | |
501 |
|
|
506 | modified.append(fn) | |
502 | elif c[0] == 'a': |
|
507 | elif c[0] == 'a': | |
503 | added.append(fn) |
|
508 | added.append(fn) | |
504 | elif c[0] == 'r': |
|
509 | elif c[0] == 'r': | |
505 | unknown.append(fn) |
|
510 | unknown.append(fn) | |
506 | elif c[2] != s.st_size or (c[1] ^ s.st_mode) & 0100: |
|
511 | elif c[2] != s.st_size or (c[1] ^ s.st_mode) & 0100: | |
507 |
|
|
512 | modified.append(fn) | |
508 |
elif |
|
513 | elif c[3] != s.st_mtime: | |
509 | lookup.append(fn) |
|
514 | lookup.append(fn) | |
510 | else: |
|
515 | else: | |
511 |
|
|
516 | unknown.append(fn) | |
512 |
|
517 | |||
513 | return (lookup, changed, added, filter(match, dc.keys()), unknown) |
|
518 | for fn, c in [(fn, c) for fn, c in dc.items() if match(fn)]: | |
|
519 | if c[0] == 'r': | |||
|
520 | removed.append(fn) | |||
|
521 | else: | |||
|
522 | deleted.append(fn) | |||
|
523 | return (lookup, modified, added, removed + deleted, unknown) | |||
514 |
|
524 | |||
515 | # used to avoid circular references so destructors work |
|
525 | # used to avoid circular references so destructors work | |
516 | def opener(base): |
|
526 | def opener(base): | |
@@ -1563,10 +1573,20 b' class localrepository:' | |||||
1563 | m, o, flag = merge[f] |
|
1573 | m, o, flag = merge[f] | |
1564 | self.merge3(f, m, o) |
|
1574 | self.merge3(f, m, o) | |
1565 | util.set_exec(self.wjoin(f), flag) |
|
1575 | util.set_exec(self.wjoin(f), flag) | |
1566 |
if moddirstate |
|
1576 | if moddirstate: | |
1567 | # only update dirstate on branch merge, otherwise we |
|
1577 | if mode == 'm': | |
1568 | # could mark files with changes as unchanged |
|
1578 | # only update dirstate on branch merge, otherwise we | |
1569 | self.dirstate.update([f], mode) |
|
1579 | # could mark files with changes as unchanged | |
|
1580 | self.dirstate.update([f], mode) | |||
|
1581 | elif p2 == nullid: | |||
|
1582 | # update dirstate from parent1's manifest | |||
|
1583 | m1n = self.changelog.read(p1)[0] | |||
|
1584 | m1 = self.manifest.read(m1n) | |||
|
1585 | f_len = len(self.file(f).read(m1[f])) | |||
|
1586 | self.dirstate.update([f], mode, st_size=f_len, st_mtime=0) | |||
|
1587 | else: | |||
|
1588 | self.ui.warn("Second parent without branch merge!?\n" | |||
|
1589 | "Dirstate for file %s may be wrong.\n" % f) | |||
1570 |
|
1590 | |||
1571 | remove.sort() |
|
1591 | remove.sort() | |
1572 | for f in remove: |
|
1592 | for f in remove: |
@@ -26,7 +26,6 b' 3aa14bbc23d9 tip' | |||||
26 | + hg update |
|
26 | + hg update | |
27 | merging file1 |
|
27 | merging file1 | |
28 | + hg diff |
|
28 | + hg diff | |
29 | FIXME: This is a known bug: |
|
|||
30 | + hg status |
|
29 | + hg status | |
31 | + hg id |
|
30 | + hg id | |
32 | 3aa14bbc23d9 tip |
|
31 | 3aa14bbc23d9 tip |
@@ -4,6 +4,7 b' mkdir t' | |||||
4 | cd t |
|
4 | cd t | |
5 | hg init |
|
5 | hg init | |
6 | echo "added file1" > file1 |
|
6 | echo "added file1" > file1 | |
|
7 | echo "another line of text" >> file1 | |||
7 | echo "added file2" > file2 |
|
8 | echo "added file2" > file2 | |
8 | hg add file1 file2 |
|
9 | hg add file1 file2 | |
9 | hg commit -m "added file1 and file2" -d "0 0" -u user |
|
10 | hg commit -m "added file1 and file2" -d "0 0" -u user |
@@ -3,36 +3,37 b'' | |||||
3 | + hg commit -m added file1 and file2 -d 0 0 -u user |
|
3 | + hg commit -m added file1 and file2 -d 0 0 -u user | |
4 | + hg commit -m changed file1 -d 0 0 -u user |
|
4 | + hg commit -m changed file1 -d 0 0 -u user | |
5 | + hg -q log |
|
5 | + hg -q log | |
6 | 1:3aa14bbc23d90e3f8b5b639b4a43d76509bae76c |
|
6 | 1:f4d7a8c73d231bc078e2a5e791325e55e8a4c252 | |
7 | 0:8633637036c18f021d771208e16ae3508ab81d28 |
|
7 | 0:232e179b3f294d467cfa66e1439bc5b0d44e4a93 | |
8 | + hg id |
|
8 | + hg id | |
9 | 3aa14bbc23d9 tip |
|
9 | f4d7a8c73d23 tip | |
10 | + hg update -C 0 |
|
10 | + hg update -C 0 | |
11 | + hg id |
|
11 | + hg id | |
12 | 8633637036c1 |
|
12 | 232e179b3f29 | |
13 | + hg id |
|
13 | + hg id | |
14 | 8633637036c1+ |
|
14 | 232e179b3f29+ | |
15 | + hg revert |
|
15 | + hg revert | |
16 | + hg diff |
|
16 | + hg diff | |
17 | + hg status |
|
17 | + hg status | |
18 | + hg id |
|
18 | + hg id | |
19 | 8633637036c1 |
|
19 | 232e179b3f29 | |
20 | + hg update |
|
20 | + hg update | |
21 | + hg diff |
|
21 | + hg diff | |
22 | + hg status |
|
22 | + hg status | |
23 | + hg id |
|
23 | + hg id | |
24 | 3aa14bbc23d9 tip |
|
24 | f4d7a8c73d23 tip | |
25 | + hg update -C 0 |
|
25 | + hg update -C 0 | |
26 | + hg update |
|
26 | + hg update | |
27 | merge: warning: conflicts during merge |
|
27 | merge: warning: conflicts during merge | |
28 | merging file1 |
|
28 | merging file1 | |
29 | merging file1 failed! |
|
29 | merging file1 failed! | |
30 | + hg diff |
|
30 | + hg diff | |
31 |
diff -r |
|
31 | diff -r f4d7a8c73d23 file1 | |
32 | --- a/file1 |
|
32 | --- a/file1 | |
33 | +++ b/file1 |
|
33 | +++ b/file1 | |
34 |
@@ -1, |
|
34 | @@ -1,3 +1,7 @@ | |
35 | added file1 |
|
35 | added file1 | |
|
36 | another line of text | |||
36 | +<<<<<<< |
|
37 | +<<<<<<< | |
37 | +changed file1 different |
|
38 | +changed file1 different | |
38 | +======= |
|
39 | +======= | |
@@ -41,20 +42,19 b' diff -r 3aa14bbc23d9 file1' | |||||
41 | + hg status |
|
42 | + hg status | |
42 | M file1 |
|
43 | M file1 | |
43 | + hg id |
|
44 | + hg id | |
44 | 3aa14bbc23d9+ tip |
|
45 | f4d7a8c73d23+ tip | |
45 | + hg revert |
|
46 | + hg revert | |
46 | + hg diff |
|
47 | + hg diff | |
47 | FIXME: This is a known bug: |
|
|||
48 | + hg status |
|
48 | + hg status | |
49 | + hg id |
|
49 | + hg id | |
50 | 3aa14bbc23d9 tip |
|
50 | f4d7a8c73d23 tip | |
51 | + hg revert -r tip |
|
51 | + hg revert -r tip | |
52 | + hg diff |
|
52 | + hg diff | |
53 | + hg status |
|
53 | + hg status | |
54 | + hg id |
|
54 | + hg id | |
55 | 3aa14bbc23d9 tip |
|
55 | f4d7a8c73d23 tip | |
56 | + hg update -C |
|
56 | + hg update -C | |
57 | + hg diff |
|
57 | + hg diff | |
58 | + hg status |
|
58 | + hg status | |
59 | + hg id |
|
59 | + hg id | |
60 | 3aa14bbc23d9 tip |
|
60 | f4d7a8c73d23 tip |
General Comments 0
You need to be logged in to leave comments.
Login now