Index: /trunk/Ohana/src/dvomerge/Makefile
===================================================================
--- /trunk/Ohana/src/dvomerge/Makefile	(revision 39299)
+++ /trunk/Ohana/src/dvomerge/Makefile	(revision 39300)
@@ -25,5 +25,6 @@
 dvoutils        : $(BIN)/dvoutils.$(ARCH)
 
-all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client dvoutils
+# all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client dvoutils
+all: dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client dvoutils
 
 #  $(SRC)/dvomergeContinue.$(ARCH).o
Index: /trunk/Ohana/src/dvomerge/include/dvomerge.h
===================================================================
--- /trunk/Ohana/src/dvomerge/include/dvomerge.h	(revision 39299)
+++ /trunk/Ohana/src/dvomerge/include/dvomerge.h	(revision 39300)
@@ -45,4 +45,5 @@
 char  *UPDATE_CATFORMAT;
 char  *UPDATE_CATCOMPRESS;
+char  *RESTRICT_CPT;
 
 int    MATCH_BY_EXTERN_ID;
Index: /trunk/Ohana/src/dvomerge/src/args.c
===================================================================
--- /trunk/Ohana/src/dvomerge/src/args.c	(revision 39299)
+++ /trunk/Ohana/src/dvomerge/src/args.c	(revision 39300)
@@ -74,4 +74,11 @@
   if ((N = get_argument (*argc, argv, "-force-merge"))) {
     FORCE_MERGE = TRUE;
+    remove_argument (N, argc, argv);
+  }
+
+  RESTRICT_CPT = NULL;
+  if ((N = get_argument (*argc, argv, "-restrict-cpt"))) {
+    remove_argument (N, argc, argv);
+    RESTRICT_CPT = strcreate (argv[N]);
     remove_argument (N, argc, argv);
   }
@@ -259,4 +266,11 @@
   }
 
+  RESTRICT_CPT = NULL;
+  if ((N = get_argument (*argc, argv, "-restrict-cpt"))) {
+    remove_argument (N, argc, argv);
+    RESTRICT_CPT = strcreate (argv[N]);
+    remove_argument (N, argc, argv);
+  }
+
   UPDATE_CATFORMAT = NULL;
   if ((N = get_argument (*argc, argv, "-update-catformat"))) {
Index: /trunk/Ohana/src/dvomerge/src/dvomergeFromList.c
===================================================================
--- /trunk/Ohana/src/dvomerge/src/dvomergeFromList.c	(revision 39299)
+++ /trunk/Ohana/src/dvomerge/src/dvomergeFromList.c	(revision 39300)
@@ -1,4 +1,7 @@
 # include "dvomerge.h"
 
+char **load_cptlist (char *filename, int *nlist);
+
+// merge from list implies 'continue' (ie, we must have already done a partial merge)
 int dvomergeFromList (int argc, char **argv) {
 
@@ -7,10 +10,11 @@
   char filename[256], *input, *output;
   IDmapType IDmap;
-  PhotCodeData *inputPhotcodes;
-  PhotCodeData *outputPhotcodes;
   int *secfiltMap = NULL;
-  char *listname, **list, inputfile[256], outputfile[256];
-  int Nlist, NLIST;
+  char inputfile[256], outputfile[256];
   int NsecfiltInput, NsecfiltOutput;
+
+  INITTIME;
+
+  dvo_image_map_init (&IDmap);
 
   if (strcasecmp (argv[2], "into")) dvomerge_usage();
@@ -21,27 +25,5 @@
   listname = argv[5];
 
-  Nlist = 0;
-  NLIST = 100;
-  ALLOCATE(list, char *, NLIST);
-  for (i = 0; i < NLIST; i++) {
-    ALLOCATE(list[i], char, 256);
-    memset(list[i], 0, 256);
-  }
-  
-  FILE *listfile = fopen(listname, "r");
-  myAssert(listfile, "error opening list");
-
-  for (i = 0; fscanf (listfile, "%s", list[i]) != EOF; i++) {
-    if (i == NLIST - 1) {
-      NLIST += 100;
-      REALLOCATE(list, char *, NLIST);
-      for (j = i + 1; j < NLIST; j++) {
-	ALLOCATE(list[j], char, 256);
-	memset(list[j], 0, 256);
-      }
-    }
-  }      
-  Nlist = i;
-  fclose(listfile);
+  char *cptlist = load_cptlist (listname, &Ncptlist);
 
   if (ALTERNATE_PHOTCODE_FILE) {
@@ -49,4 +31,7 @@
     exit (1);
   }
+
+  PhotCodeData *inputPhotcodes = NULL;
+  PhotCodeData *outputPhotcodes = NULL;
 
   SetPhotcodeTable(NULL);
@@ -58,4 +43,6 @@
   inputPhotcodes = GetPhotcodeTable();
   NsecfiltInput = GetPhotcodeNsecfilt();
+
+  if (REPLACE_TYCHO) replace_tycho_init();
 
   // since we are merging the input db into the output db, the output defines the photcode
@@ -91,8 +78,13 @@
   }
 
-  // XXX need to determine the mapping from the input to the output images
+  // need to determine the mapping from the input to the output images
+  // output dvo images must already have been merged
   dvomergeImagesGetMap (&IDmap, input, output);
 
+  // XXX we are not loading the skytable info
+
   SetPhotcodeTable(NULL);
+
+  // XXX the stuff below is equiv to stuff in dvomergeUpdate_catalogs()
 
   // loop over the populated input regions
@@ -162,4 +154,40 @@
   }
 
+  // XXX we do not update the skytable 
+
+  // XXX need to free things
+
   exit (0);
 }
+
+char **load_cptlist (char *filename, int *nlist) {
+
+  int NLIST = 100;
+  
+  char **list = NULL;
+  ALLOCATE(list, char *, NLIST);
+
+  int i;
+  for (i = 0; i < NLIST; i++) {
+    ALLOCATE(list[i], char, DVO_MAX_PATH);
+    memset(list[i], 0, DVO_MAX_PATH);
+  }
+  
+  FILE *listfile = fopen(filename, "r");
+  myAssert(listfile, "error opening list");
+
+  for (i = 0; fscanf (listfile, "%s", list[i]) != EOF; i++) {
+    if (i == NLIST - 1) {
+      NLIST += 100;
+      REALLOCATE(list, char *, NLIST);
+      for (j = i + 1; j < NLIST; j++) {
+	ALLOCATE(list[j], char, DVO_MAX_PATH);
+	memset(list[j], 0, DVO_MAX_PATH);
+      }
+    }
+  }      
+  *nlist = i;
+  fclose(listfile);
+
+  return list;
+}
Index: /trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c
===================================================================
--- /trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c	(revision 39299)
+++ /trunk/Ohana/src/dvomerge/src/dvomergeUpdate.c	(revision 39300)
@@ -99,4 +99,7 @@
   inlist = SkyListByPatch (insky, -1, &UserPatch);
 
+  // modify the list if we are restricting:
+  inlist = SkyListSubset (inlist, cptlist);
+
   // generate an output table populated at the desired depth
   outsky = SkyTableLoadOptimal (output, NULL, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
