ref: 18bfca7978bdaf7dc96e4b1a5b64ae9283856782
parent: 6039c95bcbcc70e1ab1a476d0d54f9f1d3fac183
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Sat Oct 15 22:50:52 EDT 2011
hgfs: add rev file, document in manual page
--- a/sys/man/4/hgfs
+++ b/sys/man/4/hgfs
@@ -59,15 +59,15 @@
repository.
Revision directories are named by a revision id which
-takes the form [\fId\fB.\fR]\fIhhhhhhhhhhhh\fR, where
+takes the form [\fId\fB.\fR]\fIh\fR, where
.I d
is the decimal revision number starting from 0 and
-.I hhhhhhhhhhhh
-is the hexadecimal hash prefix of the changeset. Both
+.I h
+is the hexadecimal hash of the changeset. Both
the revision number
.I d
-and the hash prefix
-.I hhhhhhhhhhhh
+and the hash
+.I h
are able to identify
a revision uniquely; only one of them needs to be given
when walking the root directory. The hexadecimal hash
@@ -79,8 +79,11 @@
In each revision directory the following files can be found:
.TP
+.B rev
+contains the revision id of the changeset.
+.TP
.B rev1
-contains the parent revision id as text.
+contains the parent revision id of the changeset.
.TP
.B rev2
If the changeset was a merge, contains the other parent revision id. Otherwise, a zero size file.
--- a/sys/src/cmd/hgfs/fs.c
+++ b/sys/src/cmd/hgfs/fs.c
@@ -13,6 +13,7 @@
enum {
Qroot,
Qrev,
+ Qrev0,
Qrev1,
Qrev2,
Qlog,
@@ -27,6 +28,7 @@
static char *nametab[] = {
"/",
nil,
+ "rev",
"rev1",
"rev2",
"log",
@@ -182,6 +184,7 @@
case Qchanges:
q->type = QTDIR;
if(0){
+ case Qrev0:
case Qrev1:
case Qrev2:
case Qlog:
@@ -237,6 +240,7 @@
case Qroot:
goto Namegen;
case Qrev:
+ case Qrev0:
case Qrev1:
case Qrev2:
ri = aux;
@@ -638,6 +642,7 @@
dirread9p(r, revgen, rf->info);
respond(r, nil);
return;
+ case Qrev0:
case Qrev1:
case Qrev2:
s = nil;
@@ -646,7 +651,7 @@
i = hashrev(&changelog, rf->info->chash);
if(rf->level == Qrev1)
i = changelog.map[i].p1rev;
- else
+ else if(rf->level == Qrev2)
i = changelog.map[i].p2rev;
Revgen:
s = fsmkrevname(buf, sizeof(buf), i);